WPF: Embedding DLR Scripts in XAML (Python, Ruby) - Part 3, A DLR Value Converter

A Visual Studio 2008 Solution with the complete code listing for this series is attached to the final part.

The WPF Binging class is very powerful and its use should be encouraged. However, it can be cumbersome to do some very simple things with it, introducing a barrier to its use. One such barrier is defining a ValueConverter.

A ValueConcverter is a class that can convert the source property value of a binding before it is set on the target property. Often such conversions are simple expressions that do not warrant the creation of a new class - though this is what is done.

The first article in this series demonstrated how to host the DLR and presented some utility methods that make executing scripts simple. Here we build upon this to create a ValueConverter that evaluates a DLR expression that supports two way binding.

Subscribe to RSS - ValueConverter