Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

How to use the editing related events in TreeGridCheckBoxColumn of WinUI TreeGrid (SfTreeGrid)?

The BeginEdit and EndEdit events are not triggered when you check or uncheck the CheckBox control in TreeGridCheckBoxColumn in WinUI TreeGrid (SfTreeGrid). However, you can get the notification while changing the CheckBox state by using the CurrentCellValueChanged event.

//Event subscription
this.sfTreeGrid.CurrentCellValueChanged += OnCurrentCellValueChanged;

//Event customization
private void OnCurrentCellValueChanged(object sender, TreeGridCurrentCellValueChangedEventArgs e)
{
    int columnindex = sfTreeGrid.ResolveToGridVisibleColumnIndex(e.RowColumnIndex.ColumnIndex);

    if (columnindex < 0)
        return;

    var column = sfTreeGrid.Columns[columnindex];

    if (column is TreeGridCheckBoxColumn)
    {
        var recordIndex = sfTreeGrid.ResolveToNodeIndex(e.RowColumnIndex.RowIndex);

        if (recordIndex < 0)
            return;

        TreeNode node = null;

        if (this.sfTreeGrid.View != null)
        {       
            //Get the TreeNode
            node = this.sfTreeGrid.View.Nodes[recordIndex];

            if (node != null)
            {
                //Checkbox property changed value is stored here.
                var value = (node.Item as EmployeeInfo).Availability;
            }
        }
    }
}

Take a moment to peruse the WinUI TreeGrid - Column Types documentation, to learn more about column types with code examples.

About

This demo shows how to use the editing related events in TreeGridCheckBoxColumn of WinUI SfTreeGrid.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages