wpf binding converterparameter object download free for windows 7 home edition 32bit

Building Better Software – One Line At A Time Building Better Software – One Line At A Time

A WPF value converter accepts a value and an optional parameter. The parameter can be specified in the XAML binding as a string like the following:

Instead of one string, what if you want to pass an array of strings as a converter parameter? What about an array of brushes?

The trick is to specify the binding in its own XAML tag and use Binding.ConverterParameter and Array. Here is an example of how to pass an array of Strings and an array of Brushes into a value converter. Note the uses of Binding, Binding.ConverterParameter, and Array.

For completeness, the implementations for the IntToStringMux and IntToBrushMux converters are also included below.

public class IntToStringMux : IValueConverter

    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

public class IntToBrushMux : IValueConverter