I have a DataGrid with three columns, including a DataGridCheckBoxColumn. Based on whether the DataGrid is visible, I want to set an event for each CheckBox in the DataGridCheckBoxColumn. I have defined an event for IsVisibleChanged.
void DataGrid_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
DataGrid dg = sender as DataGrid;
if (dg.IsVisible == false)
return;
// ?????
}
What I need to do is access every CheckBox in the DataGridCheckBoxColumn and define the same handler for the Checked and Unchecked events of each CheckBox. No rows will be added while the program is running.
I'm sure there are multiple ways, but I haven't found one yet. While I would prefer the most efficient code, I would accept any working answer.
Aucun commentaire:
Enregistrer un commentaire