Why do I get a DependencyProperty.UnsetValue when converting a value in a MultiBinding?
Posted
by eskerber
on Stack Overflow
See other posts from Stack Overflow
or by eskerber
Published on 2010-05-11T14:12:31Z
Indexed on
2010/05/11
14:24 UTC
Read the original article
Hit count: 1423
I have an extremely simple IMultiValueConverter that simply OR's two values. In the example below, I want to invert the first value using an equally simple boolean inverter.
<MultiBinding Converter="{StaticResource multiBoolToVis}">
<Binding Path="ConditionA" Converter="{StaticResource boolInverter}"/>
<Binding Path="ConditionB"/>
</MultiBinding>
public class BoolInverterConverter : IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is bool)
{
return !((bool)value);
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
#endregion
}
When I include the boolInverter, the first value in the MultiValueConverter becomes a "DependencyProperty.UnsetValue". There are no problems when I do not use the converter (other than not the logic I am aiming for, of course).
Am I missing something? Stepping through the debugger shows that the InverseBoolConverter is properly inverting the value I pass it, but that value is then not being 'sent' to the MultiValueConverter.
© Stack Overflow or respective owner