Reputation: 1800
How to disable the following converter when autosize is false. What code should I put into do nothing area.
[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();
}
}
Upvotes: 2
Views: 424
Reputation: 185225
You can try to return Binding.DoNothing
.
A binding source property or a converter can return Binding.DoNothing to instruct the binding engine not to perform any action. For example, to instruct the binding engine not to transfer a value to the binding target, not to move to the next Binding in a PriorityBinding, or not to use the FallBackValue or default value.
Upvotes: 5