5
如何传递一个整数作为ConverterParameter?
我试图绑定到一个整数属性: <RadioButton Content="None" IsChecked="{Binding MyProperty, Converter={StaticResource IntToBoolConverter}, ConverterParameter=0}" /> 而我的转换器是: [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; } …