私は WPF でオブジェクトを作成し、そのためのイベントをフックButtonしました。MouseEnterMouseEnterButtonBackground
Button button = new Button();
button.Background = Brushes.Red;
button.BorderBrush=Brushes.Red;
button.MouseEnter += new MouseEventHandler(button_MouseEnter);`
そして私のイベントは:
private void button_MouseEnter(object sender, MouseEventArgs e)
{
Button button = sender as Button;
button.Background = Brushes.Yellow;
button.BorderBrush = Brushes.Yellow;
}
イベントでボタンをBorderBrush変更しましたが、背景が機能せず、代わりにイベントでデフォルトの灰色に変わります。MouseEnterButtonBackgroundMouseEnter
どこが間違っているのでしょうか、誰か助けてください。