Change the background color of a toggle button when the toggle button is checked

后端 未结 7 723
野性不改
野性不改 2020-12-16 12:43

I want to change the background color of a toggle button when the toggle button is checked and vice versa.

How can I achieve that?

7条回答
  •  再見小時候
    2020-12-16 12:52

      if ((sender as ToggleButton).IsChecked ?? false)
              {                 
                  btnArchive.Background = (SolidColorBrush)(new
                      BrushConverter().ConvertFrom("#b8860b")); 
            }
    

提交回复
热议问题