Articles in this section
Category / Section

How to use the editing related events in GridCheckBoxColumn of WPF DataGrid (SfDataGrid)?

1 min read

The BeginEdit and EndEdit events are not triggered for GridCheckBoxColumn when check or uncheck the CheckBox control in GridCheckBoxColumn in WPF DataGrid (SfDataGrid). But you can trigger the GridCheckBoxColumn when check or uncheck the CheckBox control by using CurrentCellValueChanged event.

C#

this.datagrid.CurrentCellValueChanged += datagrid_CurrentCellValueChanged;
 
public void datagrid_CurrentCellValueChanged(object sender, CurrentCellValueChangedEventArgs args)
{          
    int columnindex = datagrid.ResolveToGridVisibleColumnIndex(args.RowColumnIndex.ColumnIndex);
    var column = datagrid.Columns[columnindex];
    if (column is GridCheckBoxColumn)
    {
        var rowIndex = this.datagrid.ResolveToRecordIndex(args.RowColumnIndex.RowIndex);
        RecordEntry record=null;
        if(this.datagrid.GroupColumnDescriptions.Count==0)
        {
            record = this.datagrid.View.Records[rowIndex] as RecordEntry;                    
        }
        else
        {
            record = (this.datagrid.View.TopLevelGroup.DisplayElements[rowIndex] as RecordEntry);
        }
        //Checkbox property changed value is stored here.
        var value = (record.Data as Model).Review;
    }
}

View sample in GitHub.

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