TreeDataGridRowSelectionModel<TModel> Class
Definition
Implements row selection functionality for a Avalonia.Controls.TreeDataGrid control.
public class TreeDataGridRowSelectionModel<TModel>
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
| Name | Description |
|---|---|
| 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
| Name | Description |
|---|---|
| BatchUpdate | Creates a batch update operation that will defer selection change notifications until disposed. |
| BeginBatchUpdate | Begins a batch update of the selection. |
| Clear | Clears the selection. |
| Deselect | Deselects an item by its index in the source data. |
| EndBatchUpdate | Ends a batch update started by Avalonia.Controls.Selection.TreeDataGridRowSelectionModel<T>.BeginBatchUpdate. |
| IsSelected | Queries whether an item is currently selected. |
| Select | Selects 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
| Name | Description |
|---|---|
| AnchorIndex | Gets or sets the anchor index. |
| Count | No summary available. |
| IsCellSelectionModel | Gets a value indicating whether this is a cell selection model. |
| RangeAnchorIndex | Gets or sets the range anchor index. |
| SelectedIndex | Gets or sets the selected index within the data. |
| SelectedIndexes | Gets the indexes of the selected items. |
| SelectedItem | Gets the currently selected item. |
| SelectedItems | Gets a collection containing all selected items. |
| SingleSelect | Gets or sets a value indicating whether only a single item can be selected at a time. |
| Source | Gets 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
| Name | Description |
|---|---|
| SelectionChanged | Occurs when the selection changes. |
| IndexesChanged | Occurs when item indexes change due to insertions or removals in the data source. Inherited from TreeDataGridSelectionModel. |
| PropertyChanged | Inherited from TreeDataGridSelectionModel. |
| SourceReset | Occurs 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.