How to use the editing related events in GridCheckBoxColumn of WinUI DataGrid (SfDataGrid)?
The BeginEdit and EndEdit events are not triggered when you check or uncheck the CheckBox control in GridCheckBoxColumn in WinUI DataGrid (SfDataGrid). However, you can get the notification while changing the CheckBox state by using the CurrentCellValueChanged event.
//Event subscription this.dataGrid.CurrentCellValueChanged += OnCurrentCellValueChanged; //Event customization public void OnCurrentCellValueChanged(object sender, CurrentCellValueChangedEventArgs args) { int columnindex = dataGrid.ResolveToGridVisibleColumnIndex(args.RowColumnIndex.ColumnIndex); if (columnindex < 0) return; var column = dataGrid.Columns[columnindex]; if (column is GridCheckBoxColumn) { var rowIndex = this.dataGrid.ResolveToRecordIndex(args.RowColumnIndex.RowIndex); if (rowIndex < 0) return; RecordEntry record = null; if (this.dataGrid.View != null) { if (this.dataGrid.View.TopLevelGroup != null) { //Get the record when grouping applied in SfDataGrid record = (this.dataGrid.View.TopLevelGroup.DisplayElements[rowIndex] as RecordEntry); } else { record = this.dataGrid.View.Records[rowIndex] as RecordEntry; } if (record != null) { //Checkbox property changed value is stored here. var value = (record.Data as OrderInfo).Review; } } } }
Take a moment to peruse the WinUI DataGrid - Column Types documentation, to learn more about column types with code examples.
Conclusion:
Hope you enjoyed learning about how to use the editing related events in GridCheckBoxColumn of WinUI DataGrid (SfDataGrid)
You can refer to our WinUI DataGrid’s feature tour page to learn about its other groundbreaking feature representations. You can explore our WinUI DataGrid documentation to understand how to present and manipulate data.
For current customers, you can check out our WinUI components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinUI DataGrid and other WinUI components.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!