私は WPF でオブジェクトを作成し、そのためのイベントをフックButton
しました。MouseEnter
MouseEnter
Button
Background
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
変更しましたが、背景が機能せず、代わりにイベントでデフォルトの灰色に変わります。MouseEnter
Button
Background
MouseEnter
どこが間違っているのでしょうか、誰か助けてください。