Skip to main content

TreeSelectionModelSelectionChangedEventArgs Class

Definition

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

Inheritance: EventArgs -> TreeSelectionModelSelectionChangedEventArgs

Remarks

This is the base class for selection change events in hierarchical selection models. It provides information about which items were selected and deselected, including both their index paths in the hierarchy and the actual item objects.

This base class provides non-generic access to selection change information, while the generic version Avalonia.Controls.Selection.TreeSelectionModelSelectionChangedEventArgs<T> provides strongly-typed access to the same information.

Important: When items are removed from the source collection, they no longer have valid index paths and therefore won't appear in Avalonia.Controls.Selection.TreeSelectionModelSelectionChangedEventArgs.DeselectedIndexes. However, the removed items will still be available in Avalonia.Controls.Selection.TreeSelectionModelSelectionChangedEventArgs.DeselectedItems. This behavior ensures that handlers can access the removed items even though their positions in the collection are no longer valid.

Properties

NameDescription
DeselectedIndexesGets the indexes of the items that were removed from the selection.
DeselectedItemsGets the items that were removed from the selection.
SelectedIndexesGets the indexes of the items that were added to the selection.
SelectedItemsGets the items that were added to the selection.

DeselectedIndexes Property

Gets the indexes of the items that were removed from the selection.

public System.Collections.Generic.IReadOnlyList<Avalonia.Controls.IndexPath> DeselectedIndexes { get; set; }

Value

A read-only list of Avalonia.Controls.IndexPath objects representing the positions in the hierarchy of the items that were deselected.

Remarks

Note that when items are removed from the source collection, they will not appear in this collection because they no longer have valid index paths. Use Avalonia.Controls.Selection.TreeSelectionModelSelectionChangedEventArgs.DeselectedItems to access items that were deselected due to being removed from the collection.

DeselectedItems Property

Gets the items that were removed from the selection.

public System.Collections.Generic.IReadOnlyList<object> DeselectedItems { get; set; }

Value

A read-only list of the item objects that were deselected.

Remarks

This property provides non-generic access to the deselected items.

Unlike Avalonia.Controls.Selection.TreeSelectionModelSelectionChangedEventArgs.DeselectedIndexes, this collection includes items that were deselected because they were removed from the source collection. This is important when handling selection changes caused by collection modifications.

SelectedIndexes Property

Gets the indexes of the items that were added to the selection.

public System.Collections.Generic.IReadOnlyList<Avalonia.Controls.IndexPath> SelectedIndexes { get; set; }

Value

A read-only list of Avalonia.Controls.IndexPath objects representing the positions in the hierarchy of the items that were selected.

SelectedItems Property

Gets the items that were added to the selection.

public System.Collections.Generic.IReadOnlyList<object> SelectedItems { get; set; }

Value

A read-only list of the item objects that were selected.

Remarks

This property provides non-generic access to the selected items.