如何在autosize为false 时禁用以下转换器.我应该在什么区域做什么代码.
[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();
}
}
Run Code Online (Sandbox Code Playgroud)
你可以尝试回来Binding.DoNothing.
绑定源属性或转换器可以返回Binding.DoNothing以指示绑定引擎不执行任何操作.例如,为了指示所述绑定引擎不将值传送到结合靶,而不是移动到下一个绑定在PriorityBinding,或不使用FallBackValue或默认值.