I've seen from some examples that it is possible to combine this kind of trigger:
<Trigger Property="IsMouseOver" Value="True">
With this kind of data trigger :
<DataTrigger Binding="{Binding IsHighlightable}" Value="True" />
By using a MultiDataTrigger like this:
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver}" Value="True"/>
<Condition Binding="{Binding IsHighlightable}" Value="True" />
</MultiDataTrigger.Conditions>
<MultiDataTrigger.Setters>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="#BF6DBDD1"/>
<Setter Property="Background" Value="{StaticResource SelectedItemBackgroundBrush}"/>
</MultiDataTrigger.Setters>
</MultiDataTrigger>
However, this does not work with attached properties. This trigger works:
<Trigger Property="UI:TreeViewHelper.IsMouseDirectlyOverItem" Value="True">
But this does not work:
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=UI:TreeViewHelper.IsMouseDirectlyOverItem}" Value="True"/>
<Condition Binding="{Binding IsHighlightable}" Value="True" />
</MultiDataTrigger.Conditions>
<MultiDataTrigger.Setters>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="#BF6DBDD1"/>
<Setter Property="Background" Value="{StaticResource SelectedItemBackgroundBrush}"/>
</MultiDataTrigger.Setters>
</MultiDataTrigger>
Is there a way I could make the trigger work correctly inside the MultiDataTrigger? The IsMouseDirectlyOverItem property was taken from here http://blogs.msdn.com/b/mikehillberg/archive/2006/09/21/mytreeviewhelperismousedirectlyoveritem.aspx.
Thanks
The syntax for attached properties is different:
Path=(UI:TreeViewHelper.IsMouseDirectlyOverItem)
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsHighlightable}" Value="True"/>
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver}" Value="True"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.Setters>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="#BF6DBDD1"/>
<Setter Property="Background" Value="{StaticResource SelectedItemBackgroundBrush}"/>
</MultiDataTrigger.Setters>
</MultiDataTrigger>
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