I am trying to bind an integer property:
<RadioButton Content="None" IsChecked="{Binding MyProperty, Converter={StaticResource IntToBoolConverter}, ConverterParameter=0}" />
and my converter:
[ValueConversion(typeof(int), typeof(bool))] public class IntToBoolConverter : IValueConverter { public object Convert(object value, Type t, object parameter, CultureInfo culture) { return value.Equals(parameter); } public object ConvertBack(object value, Type t, object parameter, CultureInfo culture) { return value.Equals(false) ? DependencyProperty.UnsetValue : parameter; } }
the problem is that when my converter is called a parameter, it is a string. I need it to be an integer. Of course, I can parse the string, but do I need?
thanks for any help
wpf binding ivalueconverter
akonsu Oct 20 '10 at 14:30 2010-10-20 14:30
source share