Is it possible to trigger one object through triggers after the occurrence of an event in another? For example, change the color of one rectangle if the cursor is over another rectangle.
To ourselves, we change the fill so much, and how to act not on ourselves?
<Window.Resources> <Style x:key="changeFill" TargetType="{x:Type Rectangle}" <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Fill" Value="Blue"/> </Trigger> </Style.Triggers> </Style> </Window.Resources> <StackPanel> <Rectangle x:Name="rect1" Width="20" Height="20" Style="{StaticResource changeFill}"> <Rectangle x:Name="rect2" Width="20" Height="20"> </StackPanel>