2009-06-01 4 views

答えて

6

希望のイベントの中に、あなたはこのような背景色を設定することができます...

// Change the background color of button1 to Blue 
button1.Background = Brushes.Blue; 

あなたはまた、トリガーでこの設定することができます。さらに詳しく

<!-- Button will change from Blue to Yellow on MouseOver --> 
<Style TargetType="{x:Type Button}"> 
    <Setter Property="Background" Value="Blue" /> 
    <Style.Triggers> 
     <Trigger Property="IsMouseOver" Value="True"> 
      <Setter Property="Background" Value="Yellow" /> 
     </Trigger> 
    </Style.Triggers> 
</Style> 

、チェックアウトをプロパティトリガーセクションthisの記事。

+2

この解決策の問題はこの質問にあります: http://stackoverflow.com/questions/1302756/why-is-the-buttons-background-changing 同じ問題が私に起こりました。背景を設定していないようです。 – JJO

+1

このコードは機能しません:トリガーはまったく適用されません! – MrAsterisco

関連する問題