If I have 2 Button
s, A
and B
, is it possible to create a Style
and a Trigger
such that when the user hovers over Button B
, it will cause Button A
's Style
to change? I've tried using SourceName
and TargetName
, and am getting compiler errors. Here's the XAML that I'm fooling around with - I'd like to cause Button A
's content to be bolded when Button B
is moused over:
<Window x:Class="WpfApplication1.Window4"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window4" Height="300" Width="300">
<Window.Resources>
<Style x:Key="BoldWhenOver" TargetType="{x:Type Button}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="FontWeight" Value="Bold" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<StackPanel>
<Button Name="btnA" Content="A" Style="{StaticResource BoldWhenOver}" />
<Button Name="btnB" Content="B" />
</StackPanel>