IdentityMine

| Tags: Laurent Bugnion

originally posted by Laurent Bugnion: (link) - please comment at original post

The Binding class has a few properties that can be set to a text, including spaces. The properties StringFormat, TargetNullValue and FallbackValue are such properties. These properties exist in WPF and newly also in Silverlight 4.

For example, you can type:

LB1

Since these strings are typed within the Binding markup extension in XAML, they do not take quote signs, which leads the XAML editor to be a little confused, as the color coding shows: The text after the “This” turns to red in the figure above.

Color alone is not really an issue, but another factor makes these strings very difficult to enter by default: The editor is configured to enter a comma after each Property/Value pair in the Binding expression. If you open the XAML editor and start typing such a binding expression, you will end up with:

LB2

Of course this will crash and burn. However you can correct this: In Visual Studio 2010, select the menu Options / Text Editor / XAML / Miscellaneous and uncheck the option “Commas to separate MarkupExtension parameters”.

LB3

From now on, commas will not be added automatically, and you will feel free!

Remember to please comment at original post: (link)

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInPin on PinterestShare on RedditShare on TumblrEmail this to someoneDigg thisFlattr the authorShare on StumbleUpon

Comments are closed.