What is the easiest way to do negation in triggers?

I want to do something like

<DataTrigger Binding="{Binding Something}" ValueIsNot="{x:Null}">
+5
source share
2 answers

I find it best to use a converter. See this blog post for an example to convert the result to a boolean.

<DataTrigger
    Binding="{Binding Path=x, Converter={StaticResource IsNotNullConverter}}"
    Value="true">
+9
source

If you want to use triggers, you can write your own or use existing ones . If you are doing MVVM, just bind the view to a property on your virtual machine that does the logic for you.

+2
source

All Articles