Question

I want the Role to be either TopLevelHeader OR TopLevelItem as well as IsPressed. Is this possible without specifying two MultiTriggers?

<MultiTrigger>

  <MultiTrigger.Conditions>

  <!--  IsPressed   -->
  <Condition Property="IsPressed" Value="True"/>
  <Condition Property="Role" Value="TopLevelHeader"/>

  </MultiTrigger.Conditions>

    <Setter TargetName="Border" Property="Background" .../>

</MultiTrigger>

TIA

Was it helpful?

Solution

Charlie Robbins has posted an article on How to use a MultiTrigger with an "or" condition:

MultiTrigger (and MultiDataTrigger) both take have a property called 'Conditions' of type ConditionCollection. Each Condition object within these ConditionCollections can be used in one of two ways:

  1. You can set the Property and Value properties to setup an ordinary property condition.
  2. You can set the Binding and Value properties to setup a data condition.

Now if you want to accomplish an or condition in either case you will actually use a MultiDataTrigger. The gotcha here is that we can use the Binding property of the Condition class in conjunction with a MultiValueConverter to get the desired behavior... read more

He's posted a sample solution as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top