Replacing converters with Silverlight 4 BindingBase properties

In the previous recipe, we saw that using converters in data binding expressions can help us with a variety of things we want to do with the value that's being bound. It helps us in formatting the value as well as switching between colors. However, creating the converter can be a bit cumbersome for some tasks. To use it, we have to create the class that implements the IValueConverter interface, instantiate it, and change the binding expression. Silverlight 4 has added some properties on the BindingBase class that can relieve us from writing a converter in some occasions.

In this recipe, we'll look at how these three new properties, namely TargetNullValue, StringFormat, and FallbackValue ...

Get Silverlight 4 Data and Services Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.