Silverlight Feeds - All your Silverlight feeds in one place.

Sponsors

Wednesday, January 20, 2010

Avoiding issues when typing text in Bindings

by Laurent Bugnion via Silverlight on 1/20/2010 11:27:02 AM

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:

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:

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”.

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

 

email it!bookmark it!digg it!

Original Post: Avoiding issues when typing text in Bindings

Subscribe

New Feed

Product Spotlight

Recently Updated Sources

Legal Note

The content of the postings is owned by the respective author. Silverlight Feeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on Silverlight Feeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us