WPF Reflections

Mar 9 2008   6:53AM GMT

Multi value converter in databinding



Posted by: Mark Shurmer
XAML, C, Databinding, WPF

Here’s a nifty little trick that I recently discovered.

When you need to calculate the result of two properties and display it, you can do it via a Converter class.
You may want to do it, like me, if you couldn’t update the business objects, or didn’t want to.

How do you do it?
Your converter class needs to implement IMultiValueConverter instead of IValueConverter.

E.g.:

Converter class

Then you specify a multi binding in your xaml, like:

blog08mar2008-window.JPG

Comment on this Post


You must be logged-in to post a comment. Log-in/Register