Wednesday, March 28, 2012

Converters in XAML

On a Silverlight course this week. When working with data in WPF or SilverLight, you can bind data to properties, such as background colour. However, you will need to convert it to an actual colour. This can be done in WPF using triggers, but if you want to use code, create a new class that inherits from IValueConverter, and you can use that helpful little "Apply Data Binding" wizard to assign the converter to a property. Very useful.

No comments:

Post a Comment