1
私は、異なるメンバ変数で囲まれた3つのテキストブロックを含むスタックパネルを持っています。I私は別のテキストブロックのマウスオーバーイベントですか?
は、マウスオーバープロパティに基づいてテキストブロックフォアグラウンドでプロパティを設定します。私は、同じパネルのすべてのテキストブロックのプロパティの上にマウスであるか、私は各
、すべてのTextBlockに設定する必要があり
を使用することができますか?私がトリガーを使用しているのは初めてです。ここで
は私のコード
<StackPanel Grid.ColumnSpan="3" HorizontalAlignment="Left" Orientation="Horizontal" Margin="0,-3,0,2.932">
<TextBlock Grid.Column="0" Text="{Binding Path=Location}" Foreground="#FFFFF1A5" Style="{StaticResource Textstyle}" />
<TextBlock Grid.Column="1" Text="{Binding Path=Name}" Foreground="#FFFFF1A5" Style="{StaticResource Textstyle}" />
<TextBlock Grid.Column="2" Text="{Binding Path=Age}"Foreground="#FFFFF1A5" Style="{StaticResource Textstyle}" />
<StackPanel.Resources>
<Style x:Key="Textstyle" TargetType="{x:Type TextBlock}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="#FFFFFFFF"/>
</Trigger>
</Style.Triggers>
</Style>
</StackPanel.Resources>
</StackPanel>
は私のアプローチで何か問題がありますか?
イムはthis.Pleaseから任意の結果を得ていないので、あなたの地元のForegroundプロパティは、スタイルをオーバーライドしている私のquestion.please