Home Contact

X

Coder, not artist.

News

All code on here is free, but as a consequence it's up to you to check it, ha! If you have any questions, please use the contact button!

Twitter












Archives

Post Categories

Image Galleries

Syndication:

StringFormat annoyances in VS2008

I’ve been using StringFormat in my xaml quite a bit recently, and whilst I’ve liked it, I’ve found that code which is valid tends to cause VS2008 to no longer be able to represent the designer (which some might say is a good thing)…

Basically, the following code:

<TextBlock Text="{Binding MyValue, StringFormat=The value is {0}}"/>

causes VS to basically say ‘no way’ and can no longer render the xaml. Pressing F5 shows the Window just fine… Soo… What can we do about it?

If we modify the ‘StringFormat’ section to read as such:

<TextBlock Text="{Binding MyValue, StringFormat='The value is {0}'}"/>

VS can represent it just fine… The difference? The single quote characters around the value of the StringFormat.

Both versions are valid xaml, just VS can’t represent the former.

Ahh well.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Wednesday, July 22, 2009 9:10 AM

Feedback

# re: StringFormat annoyances in VS2008

Thanks, I was having problems with this as well. I appreciate it. 8/6/2010 10:41 PM | Andrew

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: