WPF Check box: Check changed handling

后端 未结 6 900
忘掉有多难
忘掉有多难 2020-12-01 13:33

In WPF data binding, I can bind the IsChecked property to some data, e.g. user setting, but I need to handle \"CheckChanged\" event, I know I can seperately handle <

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-01 14:18

    As a checkbox click = a checkbox change the following will also work:

    
    
    private void CheckBox_Click(object sender, RoutedEventArgs e)
    {
        // ... do some stuff
    }
    

    It has the additional advantage of working when IsThreeState="True" whereas just handling Checked and Unchecked does not.

提交回复
热议问题