C# 如何在某些情况下禁用转换器
当自动调整大小为false时,如何禁用以下转换器。我应该在什么都不做区域中输入什么代码C# 如何在某些情况下禁用转换器,c#,wpf,xaml,C#,Wpf,Xaml,当自动调整大小为false时,如何禁用以下转换器。我应该在什么都不做区域中输入什么代码 [ValueConversion(typeof(Boolean), typeof(Double))] public class ConvertAutoSize2HeightWidth : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture
[ValueConversion(typeof(Boolean), typeof(Double))]
public class ConvertAutoSize2HeightWidth : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Boolean autosize = (Boolean)value;
if (autosize)
return Double.NaN;
else
//**do nothing**
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
你可以试着回去
绑定源属性或转换器可以返回binding.DoNothing以指示绑定引擎不执行任何操作。例如,指示绑定引擎不要将值传输到绑定目标,不要移动到中的下一个,或者不要使用回退值或默认值