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
Just in addition to all other answers, I usually add these lines to the beginning of Convert
method:
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Any(x => x == DependencyProperty.UnsetValue))
return DependencyProperty.UnsetValue;
...
}
to make sure that none of the values is unset (that usually happens with DataGrid
with CanUserAddRows="True"
).