WPF dataGrid中的check的改变事件

关于datagrid信息:

<DataGridTemplateColumn Header="备注">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding IsChecked,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Click="CheckBox_Click"></CheckBox>
<TextBlock Text="{Binding strNo}"></TextBlock>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

类的改变事件:

public bool Checked2;
public bool IsChecked
{
set
{
Checked2 = value;
OnPropertyChanged("IsChecked");
}
get
{
return Checked2;
}
}
public event PropertyChangedEventHandler PropertyChanged;

protected void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}

原文地址:https://www.cnblogs.com/wlming/p/5084799.html