I want my image Visibility property set to Hidden when my bound table field
Weblink = NULL **OR** Weblink = ""
With MultiDataTrigger you can test several conditions in the following logic:
"IF FieldA = 1 **AND** FieldB = 2 THEN"
But what I need is
"IF FieldA = 1 **OR** FieldA = 2 THEN"
Here is part of my xaml whitch is only working when Weblink = ""; when Weblink = NULL my image stays visible
<Image.Style>
<Style TargetType="{x:Type Image}">
<Style.Triggers>
<DataTrigger Binding="{Binding Weblink}" Value="Null">
<Setter Property="Visibility" Value="Hidden" />
</DataTrigger>
<DataTrigger Binding="{Binding Weblink}" Value="">
<Setter Property="Visibility" Value="Hidden" />
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
Thanks in advance ! Spoelle
What you wrote is equal to Weblink == "Null"
but you need Weblink == null
.
Try Value="{x:Null}"
in the DataTrigger when the the Weblink property returns with null.
I would suggest using the x:Null
markup extension, and for sake of clarity explicitly specify the empty string by using the x:Static
markup extension:
<DataTrigger Binding="{Binding Weblink}" Value="{x:Null}">
<Setter Property="Visibility" Value="Hidden" />
</DataTrigger>
<DataTrigger Binding="{Binding Weblink}" Value="{x:Static System:String.Empty}" >
<Setter Property="Visibility" Value="Hidden" />
</DataTrigger>
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With