Skip to main content

TreeDataGridIndexesChangedEventArgs Class

Definition​

Assembly:Avalonia.Controls.TreeDataGrid
Package:Avalonia.Controls.TreeDataGrid
public class TreeDataGridIndexesChangedEventArgs

Inheritance: EventArgs -> TreeDataGridIndexesChangedEventArgs

Remarks​

This event is raised when indexes in the selection model change due to insertions, removals, or reordering in the underlying data source. It provides information about which range of indexes was affected and how they were shifted.

Constructors​

TreeDataGridIndexesChangedEventArgs Constructor​

Initializes a new instance of the Avalonia.Controls.Selection.TreeDataGridIndexesChangedEventArgs class.

public TreeDataGridIndexesChangedEventArgs(Avalonia.Controls.IndexPath parentIndex, int startIndex, int endIndex, int delta)

Parameters​

parentIndex Avalonia.Controls.IndexPath

The index path of the parent item whose children were affected.

startIndex int

The index at which the change started.

endIndex int

The index at which the change ended.

delta int

The number of items added or removed.

Remarks​

The delta parameter will be positive when items are added and negative when items are removed.

The affected range is from startIndex (inclusive) to endIndex (exclusive).

Properties​

NameDescription
DeltaGets the delta of the change; i.e. the number of indexes added or removed.
EndIndexGets the exclusive end index of the range of indexes that changed.
ParentIndexGets the index of the parent item.
StartIndexGets the inclusive start index of the range of indexes that changed.

Delta Property​

Gets the delta of the change; i.e. the number of indexes added or removed.

public int Delta { get; set; }

Value​

A positive value indicates items were added; a negative value indicates items were removed.

Remarks​

When items are added, Avalonia.Controls.Selection.TreeDataGridIndexesChangedEventArgs.Delta represents the number of items inserted.

When items are removed, Avalonia.Controls.Selection.TreeDataGridIndexesChangedEventArgs.Delta is negative and its absolute value represents the number of items removed. This value is used to adjust index paths that point to items after the change.

EndIndex Property​

Gets the exclusive end index of the range of indexes that changed.

public int EndIndex { get; set; }

Remarks​

This is one past the last index affected by the change. The range of affected indexes is from Avalonia.Controls.Selection.TreeDataGridIndexesChangedEventArgs.StartIndex (inclusive) to Avalonia.Controls.Selection.TreeDataGridIndexesChangedEventArgs.EndIndex (exclusive).

ParentIndex Property​

Gets the index of the parent item.

public Avalonia.Controls.IndexPath ParentIndex { get; set; }

Remarks​

For changes at the root level, this will be an empty index path.

StartIndex Property​

Gets the inclusive start index of the range of indexes that changed.

public int StartIndex { get; set; }

Remarks​

This is the first index affected by the change.