プレスカラーとホバーカラーを使用したカスタムwpfボタンがありますが、いつも設定したくありません。ボタンの背景としてカラーのデフォルトカラーをホバーしますか? `wpfボタンでホバーカラーとプレスカラー、デフォルト値をバックグラウンドに設定する方法
public Brush HoverBackground
{
get { return (Brush)GetValue(HoverBackgroundProperty); }
set { SetValue(HoverBackgroundProperty, value); }
}
public static readonly DependencyProperty HoverBackgroundProperty =
DependencyProperty.Register("HoverBackground", typeof(Brush), typeof(CustomButton));
といくつかのカスタムpropertys
useage:Hoverbackgroundその後、<xx:CustomButton Background="xx"/>
: 私はちょうどこれをしたいすべての時間
<xx:CustomButton Background="xxx",HoverBacground="xx"/>
これを書きたくはありませんバークグラウンドと同じになります
私はこの新しいUIPropertyMetadata(背景)のように設定することはできません –