Skip to main content

TreeDataGridRowSelectionModel<TModel> Class

Definition

Assembly:Avalonia.Controls.TreeDataGrid
Package:Avalonia.Controls.TreeDataGrid

Implements row selection functionality for a Avalonia.Controls.TreeDataGrid control.

public class TreeDataGridRowSelectionModel<TModel>

Inheritance: object -> TreeDataGridSelectionModel -> TreeDataGridRowSelectionModel<TModel>

Implements: ae, af

Remarks

TreeDataGridRowSelectionModel manages row selection in a TreeDataGrid, supporting both single and multiple selection modes. It tracks selection using Avalonia.Controls.IndexPath instances that represent positions in the hierarchical structure.

Row selection supports the following user interactions:

  • Clicking on rows to select them
  • Using arrow keys to navigate between rows
  • Using Shift key to select ranges of rows
  • Expanding and collapsing hierarchical rows with arrow keys
  • Type-to-select functionality for quickly finding rows

Constructors

NameDescription
TreeDataGridRowSelectionModel<TModel>No summary available.

TreeDataGridRowSelectionModel<TModel> Constructor

public TreeDataGridRowSelectionModel<TModel>(Avalonia.Controls.TreeDataGridSource<TModel><TModel> source)

Parameters

source Avalonia.Controls.TreeDataGridSource<TModel><TModel>

Methods

NameDescription
BatchUpdateCreates a batch update operation that will defer selection change notifications until disposed.
BeginBatchUpdateBegins a batch update of the selection.
ClearClears the selection.
DeselectDeselects an item by its index in the source data.
EndBatchUpdateEnds a batch update started by Avalonia.Controls.Selection.TreeDataGridRowSelectionModel<T>.BeginBatchUpdate.
IsSelectedQueries whether an item is currently selected.
SelectSelects an item by its index in the source data.

BatchUpdate Method

Creates a batch update operation that will defer selection change notifications until disposed.

public Avalonia.Controls.Selection.TreeDataGridRowSelectionModel<TModel>.BatchUpdateOperation<TModel><TModel> BatchUpdate()

Returns

Avalonia.Controls.Selection.TreeDataGridRowSelectionModel<TModel>.BatchUpdateOperation<TModel><TModel>

A disposable object that, when disposed, will commit the selection changes and raise appropriate events.

Remarks

Use this method with a using statement to group multiple selection operations together and raise only a single set of change events when the batch is complete. This is equivalent to calling Avalonia.Controls.Selection.TreeDataGridRowSelectionModel<T>.BeginBatchUpdate and Avalonia.Controls.Selection.TreeDataGridRowSelectionModel<T>.EndBatchUpdate.

BeginBatchUpdate Method

Begins a batch update of the selection.

public void BeginBatchUpdate()

Clear Method

Clears the selection.

public void Clear()

Deselect Method

Deselects an item by its index in the source data.

public void Deselect(Avalonia.Controls.IndexPath index)

Parameters

index Avalonia.Controls.IndexPath

The index into the source data.

EndBatchUpdate Method

Ends a batch update started by Avalonia.Controls.Selection.TreeDataGridRowSelectionModel<T>.BeginBatchUpdate.

public void EndBatchUpdate()

IsSelected Method

Queries whether an item is currently selected.

public bool IsSelected(Avalonia.Controls.IndexPath index)

Parameters

index Avalonia.Controls.IndexPath

The index of the item in the source data.

Returns

bool

True if the item is selected; otherwise false.

Select Method

Selects an item by its index in the source data.

public void Select(Avalonia.Controls.IndexPath index)

Parameters

index Avalonia.Controls.IndexPath

The index path of the item to select.

Properties

NameDescription
AnchorIndexGets or sets the anchor index.
CountNo summary available.
IsCellSelectionModelGets a value indicating whether this is a cell selection model.
RangeAnchorIndexGets or sets the range anchor index.
SelectedIndexGets or sets the selected index within the data.
SelectedIndexesGets the indexes of the selected items.
SelectedItemGets the currently selected item.
SelectedItemsGets a collection containing all selected items.
SingleSelectGets or sets a value indicating whether only a single item can be selected at a time.
SourceGets the data source for the selection model.

AnchorIndex Property

Gets or sets the anchor index.

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

Count Property

public int Count { get; set; }

IsCellSelectionModel Property

Gets a value indicating whether this is a cell selection model.

public bool IsCellSelectionModel { get; set; }

RangeAnchorIndex Property

Gets or sets the range anchor index.

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

SelectedIndex Property

Gets or sets the selected index within the data.

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

SelectedIndexes Property

Gets the indexes of the selected items.

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

SelectedItem Property

Gets the currently selected item.

public TModel SelectedItem { get; set; }

Value

The selected item, or default(TModel) if no item is selected.

Remarks

When multiple items are selected, this property returns the first selected item.

SelectedItems Property

Gets a collection containing all selected items.

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

Value

A read-only list of the selected items.

SingleSelect Property

Gets or sets a value indicating whether only a single item can be selected at a time.

public bool SingleSelect { get; set; }

Source Property

Gets the data source for the selection model.

public System.Collections.IEnumerable Source { get; set; }

Events

NameDescription
SelectionChangedOccurs when the selection changes.
IndexesChangedOccurs when item indexes change due to insertions or removals in the data source. Inherited from TreeDataGridSelectionModel.
PropertyChangedInherited from TreeDataGridSelectionModel.
SourceResetOccurs when the data source is reset. Inherited from TreeDataGridSelectionModel.

SelectionChanged Event

Occurs when the selection changes.

public event EventHandler<Avalonia.Controls.Selection.TreeDataGridSelectionChangedEventArgs<T><TModel>> SelectionChanged

Remarks

This event provides strongly-typed access to the selection changes, including the items and index paths that were selected and deselected.