I recently cried when I found that MultiTrigger.Conditions utilize AND logic always, and not OR logic. So, therefore if I want to fire off a group of setters on condition A OR condition B, and stay entirely with XAML, I must write two separate triggers. Each trigger then has the same exact set of setters--adding redundant code.
Is there any way to create a group of triggers and reference them? This would at least let me reuse my triggers without copy + paste redundancy. See my PseudoCode examples below to see what I mean:
Normal Way (with redundancy):
<ControlTemplate.Triggers><Trigger Property="IsMouseOver" Value="True"><Setter Property="Foreground" Value="White" /><Setter TargetName="buttonBorder" Property="BorderThickness" Value="5.0" /><Setter TargetName="buttonBorder" Property="Background" Value="Red" /></Trigger><!-- Unfortunately I have to pose redundant code for the second trigger's Setters as the conditional logic for a group of MultiTriggers is AND, not OR. --><Trigger Property="IsFocused" Value="True"><Setter Property="Foreground" Value="White" /><Setter TargetName="buttonBorder" Property="BorderThickness" Value="5.0" /><Setter TargetName="buttonBorder" Property="Background" Value="Red" /></Trigger></ControlTemplate.Triggers>
Desired way, with pseudo code on
<!-- This is bogus code, just to show the intent of having a group of setters identified with a name to reference later--><Trigger.Setters x:Name="SetterGroup1"><Setter Property="Foreground" Value="White" /><Setter TargetName="buttonBorder" Property="BorderThickness" Value="5.0" /><Setter TargetName="buttonBorder" Property="Background" Value="Red" /></Trigger.Setters><!-- Notice in my bogus pseudo-code that I'm referencing back to SetterGroup1--><ControlTemplate.Triggers><Trigger Property="IsMouseOver" Value="True"><Trigger.Setters Value="SetterGroup1" /></Trigger><Trigger Property="IsFocused" Value="True"><Trigger.Setters Value="SetterGroup1" /></Trigger></ControlTemplate.Triggers>
Thanks very much if you either know that this is definitely Impossible (saving me time) or if you know a way to do it.