5
いくつかのボタンを使用してWPFアプリケーションを開発しました。今私はトリガーや他のイベントを使用してonmouseover、onmouseleave、onmouseenterこれらのボタンの色を変更したいと思います。 提案はありますか? ありがとうございます。トリガーやその他のイベントを使用してonmoveover、wmfのonmouseleaveを変更する方法
いくつかのボタンを使用してWPFアプリケーションを開発しました。今私はトリガーや他のイベントを使用してonmouseover、onmouseleave、onmouseenterこれらのボタンの色を変更したいと思います。 提案はありますか? ありがとうございます。トリガーやその他のイベントを使用してonmoveover、wmfのonmouseleaveを変更する方法
希望のイベントの中に、あなたはこのような背景色を設定することができます...
// 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の記事。
この解決策の問題はこの質問にあります: http://stackoverflow.com/questions/1302756/why-is-the-buttons-background-changing 同じ問題が私に起こりました。背景を設定していないようです。 – JJO
このコードは機能しません:トリガーはまったく適用されません! – MrAsterisco