在 xaml 中将代码设置为:
<CheckBox x:Name="cbxNew" Content="New" IsChecked="true" Checked="cbxNew_Checked" />
private void cbxNew_Checked(object sender, RoutedEventArgs e)
{
this.txtTest.Text = "";
}
然后运行应用程序并得到错误:
Set Property
System.Windows.Controls.Primitives.ToggleButton.IsChecked threw an exception
好惊讶。如何解决这个问题?