有一個自定義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
用途: 我不想寫這一切
<xx:CustomButton Background="xxx",HoverBacground="xx"/>
我只是想這個時間:<xx:CustomButton Background="xx"/>
那麼Hoverbackground將與Bacground相同
`
這是行不通的...我不能設置像這樣新的UIPropertyMetadata(背景) –