I encountered a situation where I can easily achieve the same functionality by using a MultiDataTrigger
or, alternately, using a DataTrigger
with a MultiBinding
. Are there any substantive reasons to prefer one approach over the other?
With MultiDataTrigger:
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=SomePath}" Value="SomeValue"/>
<Condition Binding="{Binding Path=SomeOtherPath, Converter={StaticResource SomeConverter}}" Value="SomeOtherValue"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource MyStoryboard}"/>
</MultiDataTrigger.EnterActions>
</MultiDataTrigger>
With MultiBinding:
<DataTrigger Value="foo">
<DataTrigger.Binding>
<MultiBinding Converter="{StaticResource fooConv}"/>
<Binding Path=SomePath/>
<Binding Path=SomeOtherPath/>
</MultiBinding>
</DataTrigger.Binding>
<DataTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource MyStoryboard}"/>
</DataTrigger.EnterActions>
</DataTrigger>
Multibinding
requires a converter for all but the rarest circumstances (using StringFormat
).
MultiTrigger
only requires a converter to get your binding results into boolean
s.