O'Reilly logo

MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide by Johnny Tordgeman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating and consuming value converters

A value converter allows you to dynamically convert values during the process of data binding before the bound value is actually used. A value converter at heart, is a custom class that inherits from the IValueConverter interface. This interface contains two methods—Convert and ConvertBack—which we have to implement. Once the value converter is created, we can use it directly in our XAML.

Converters let us define custom logic for the different properties we have in our application. It is not uncommon to see a converter that converts one type of value to a completely different type, for example, a converter that converts a number value to a color value. Another example would be a conversation of text to Boolean ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required