#1,137 – Value Converter Basics

A value converter is a class that knows how to convert data as part of the data binding process.  It can convert data in two directions:

  • From the data type of a bound property to the data type required by the attribute that is binding to the property (output)
  • From the data type of an attribute to the data type of a bound property (input)

A value converter implements the IValueConverter interface.  IValueConverter.Convert is used for output, converting from a bound property value to the type required by an attribute.  For example, you might have a integer property that you bind to and use in setting the background color of a particular control.

IValueConverter.ConvertBack is used for input, converting from an attribute’s value to a bound property.

Advertisement

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: