Skip to main content

TreeSelectionModelSelectionChangedEventArgs<T> Class

Definition

Assembly:Avalonia.Controls.TreeDataGrid
Package:Avalonia.Controls.TreeDataGrid
public class TreeSelectionModelSelectionChangedEventArgs<T>

Inheritance: EventArgs -> TreeSelectionModelSelectionChangedEventArgs -> TreeSelectionModelSelectionChangedEventArgs<T>

Remarks

This class extends Avalonia.Controls.Selection.TreeSelectionModelSelectionChangedEventArgs to provide strongly-typed access to the selected and deselected items, making it easier to work with the specific item types in the selection model.

It provides information about which items were selected and deselected, including both their index paths in the hierarchy and the actual item objects.

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<T>.DeselectedIndexes. However, the removed items will still be available in Avalonia.Controls.Selection.TreeSelectionModelSelectionChangedEventArgs<T>.DeselectedItems. This behavior ensures that handlers can access the removed items even though their positions in the collection are no longer valid.

Constructors

NameDescription
TreeSelectionModelSelectionChangedEventArgs<T>No summary available.

TreeSelectionModelSelectionChangedEventArgs<T> Constructor

public TreeSelectionModelSelectionChangedEventArgs<T>(System.Collections.Generic.IReadOnlyList<Avalonia.Controls.IndexPath> deselectedIndexes, System.Collections.Generic.IReadOnlyList<Avalonia.Controls.IndexPath> selectedIndexes, System.Collections.Generic.IReadOnlyList<T> deselectedItems, System.Collections.Generic.IReadOnlyList<T> selectedItems)

Parameters

deselectedIndexes System.Collections.Generic.IReadOnlyList<Avalonia.Controls.IndexPath>

selectedIndexes System.Collections.Generic.IReadOnlyList<Avalonia.Controls.IndexPath>

deselectedItems System.Collections.Generic.IReadOnlyList<T>

selectedItems System.Collections.Generic.IReadOnlyList<T>

Properties

NameDescription
DeselectedIndexesGets the indexes of the items that were removed from the selection.
DeselectedItemsGets the strongly-typed items that were removed from the selection.
SelectedIndexesGets the indexes of the items that were added to the selection.
SelectedItemsGets the strongly-typed 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<T>.DeselectedItems to access items that were deselected due to being removed from the collection.

DeselectedItems Property

Gets the strongly-typed items that were removed from the selection.

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

Value

A read-only list of the items that were deselected, typed as T.

Remarks

This property hides the base class property to provide strongly-typed access to the deselected items.

Unlike Avalonia.Controls.Selection.TreeSelectionModelSelectionChangedEventArgs<T>.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.

Remarks

This property overrides the base class property to provide the specific implementation for this event args class.

SelectedItems Property

Gets the strongly-typed items that were added to the selection.

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

Value

A read-only list of the items that were selected, typed as T.

Remarks

This property hides the base class property to provide strongly-typed access to the selected items.