Change style on parent mouseover
I've made a trigger for a viewbox that when the mouse is over the viewbox,
the content changes.
This works, but because the content of the viewbox is small I want to have
a border around the viewbox that also triggers the mouseover event.
<Viewbox Width="50" x:Name="ActionIconBox1" Height="40.5">
<ContentControl>
<ContentControl.Style>
<Style TargetType="{x:Type ContentControl}">
<Setter Property="Content" Value="{StaticResource
action_message}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding
RelativeSource={RelativeSource
AncestorType=Viewbox,AncestorLevel=1},
Path=IsMouseOver}" Value="True" >
<Setter Property="Content"
Value="{StaticResource
action_message_focus}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</Viewbox>
This only works when the mouse is on the contentcontrol, not when the
mouse enters the Viewbox.
The resource is a canvas
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="appbar_message" Width="76" Height="76" Clip="F1 M 0,0L 76,0L
76,76L 0,76L 0,0">
<Path Width="38" Height="39.75" Canvas.Left="19" Canvas.Top="22"
Stretch="Fill" Fill="#FF1BA1E2" Data="F1 M 33,51L 36.4167,61.75L 24,51L
19,51L 19,22L 57,22L 57,51L 33,51 Z "/> </Canvas>
Why doesn't the binding work?
No comments:
Post a Comment