Articles in this section
Category / Section

How to listen checked state change of the check boxes in WPF DataGrid(SfDataGrid) GridCheckBoxColumn?

2 mins read

In WPF DataGrid(SfDataGrid), there is no direct event to listen the checked state change of the checkboxes in the GridCheckBoxColumn. You can listen the check state change of the check box by using SfDataGrid.CurrentCellValueChanged event.

 

private void DataGrid_CurrentCellValueChanged(object sender, Syncfusion.UI.Xaml.Grid.CurrentCellValueChangedEventArgs e)
{
    SfDataGrid grid = sender as SfDataGrid;
    int columnindex = grid.ResolveToGridVisibleColumnIndex(e.RowColumnIndex.ColumnIndex);
    var column = grid.Columns[columnindex];
    if (column.GetType() == typeof(GridCheckBoxColumn) && column.MappingName == "IsDelivered")
    {
        var rowIndex = grid.ResolveToRecordIndex(e.RowColumnIndex.RowIndex);
        var record = grid.View.Records[rowIndex].Data as OrderInfo;
 
        var value = record.IsDelivered;
    }
}

 

Take a moment to peruse the documentation, where you can find about GridCheckBoxColumn, with code examples.

Please refer this link to know about the essential features of Syncfusion WPF DataGrid.

You can download the example from GitHub

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied