We’re usually able to clear all these binding errors, but there’s a specially sneaky one that we can’t fix (basically we set an object to null, and that object is the DataContext for a Rectangle.Fill property), so we thought that setting the FallBackValue would make it go away, but we still get the binding error:
System.Windows.Data Error: 6 : 'TargetDefaultValueConverter' converter failed to convert value '' (type 'String'); fallback value will be used, if available.
Is there a way to not get these errors when using the fallback value? I mean, that’s what it’s for isn’t it? Why should it still show the error?
This is the Binding:
<Rectangle x:Name="rectangle" Fill="{Binding Mode=OneTime, TargetNullValue={StaticResource someBrush}}" Height="23" Margin="0,1.5,0,1.5" Width="100" />
Lmk, thanks!
With this
if I set DataContext = null, I get a blue rectangle,
if I set DataContext = Brushes.Yellow, I get a yellow rectangle. And no binding errors.