TreeDataGridCellSelectionModel<TModel> Class
Definition
Implements cell selection functionality for a Avalonia.Controls.TreeDataGrid control.
public class TreeDataGridCellSelectionModel<TModel>
Remarks
TreeDataGridCellSelectionModel manages cell selection in a TreeDataGrid, supporting both single and multiple selection modes.
Cell selection supports the following user interactions:
- Clicking on cells to select them
- Using arrow keys to navigate between cells
- Using Shift key to select ranges of cells
Constructors
| Name | Description |
|---|---|
| TreeDataGridCellSelectionModel<TModel> | No summary available. |
TreeDataGridCellSelectionModel<TModel> Constructor
public TreeDataGridCellSelectionModel<TModel>(Avalonia.Controls.ITreeDataGridSource<TModel><TModel> source)
Parameters
source Avalonia.Controls.ITreeDataGridSource<TModel><TModel>
Methods
| Name | Description |
|---|---|
| BeginBatchUpdate | Begins a batch update of the selection. |
| EndBatchUpdate | Ends a batch update started by Avalonia.Controls.Selection.TreeDataGridCellSelectionModel<T>.BeginBatchUpdate. |
| IsSelected (2 overloads) | Checks whether the specified cell is selected. |
| SetSelectedRange | Sets the current selection to the specified range of cells. |
BeginBatchUpdate Method
Begins a batch update of the selection.
public void BeginBatchUpdate()
Remarks
During a batch update no changes to the selection will be reflected in the model's properties and no events will be raised until Avalonia.Controls.Selection.TreeDataGridCellSelectionModel<T>.EndBatchUpdate is called.
Avalonia.Controls.Selection.TreeDataGridCellSelectionModel<T>.BeginBatchUpdate may be called multiple times, even when a batch update is already in progress; each call must have a corresponding call to Avalonia.Controls.Selection.TreeDataGridCellSelectionModel<T>.EndBatchUpdate in order to finish the operation.
EndBatchUpdate Method
Ends a batch update started by Avalonia.Controls.Selection.TreeDataGridCellSelectionModel<T>.BeginBatchUpdate.
public void EndBatchUpdate()
IsSelected overloads
IsSelected Method
Checks whether the specified cell is selected.
public bool IsSelected(Avalonia.Controls.CellIndex index)
Parameters
index Avalonia.Controls.CellIndex
The index of the cell.
Returns
bool
IsSelected Method
Checks whether the specified cell is selected.
public bool IsSelected(int columnIndex, Avalonia.Controls.IndexPath rowIndex)
Parameters
columnIndex int
The column index of the cell.
rowIndex Avalonia.Controls.IndexPath
The row index of the cell.
Returns
bool
SetSelectedRange Method
Sets the current selection to the specified range of cells.
public void SetSelectedRange(Avalonia.Controls.CellIndex start, int columnCount, int rowCount)
Parameters
start Avalonia.Controls.CellIndex
The cell from which the selection should start.
columnCount int
The number of columns in the selection.
rowCount int
The number of rows in the selection.
Properties
| Name | Description |
|---|---|
| Count | Gets the number of cells currently selected. |
| SelectedIndex | Gets or sets the index of the currently selected cell. |
| SelectedIndexes | Gets a read-only list of the indices of all selected cells. |
| SingleSelect | Gets or sets a value indicating whether only a single cell can be selected at a time. |
Count Property
Gets the number of cells currently selected.
public int Count { get; set; }
SelectedIndex Property
Gets or sets the index of the currently selected cell.
public Avalonia.Controls.CellIndex SelectedIndex { get; set; }
Remarks
If multiple cells are selected, this property represents the anchor cell of the selection. Setting this property will select the cell at the specified index and deselect all other cells.
SelectedIndexes Property
Gets a read-only list of the indices of all selected cells.
public System.Collections.Generic.IReadOnlyList<Avalonia.Controls.CellIndex> SelectedIndexes { get; set; }
Value
A read-only list of Avalonia.Controls.CellIndex objects representing the coordinates of all selected cells.
SingleSelect Property
Gets or sets a value indicating whether only a single cell can be selected at a time.
public bool SingleSelect { get; set; }
Remarks
When set to true, selecting a cell will deselect any previously selected cells. When set to false, additional cells can be selected by holding Shift.
Events
| Name | Description |
|---|---|
| SelectionChanged | Occurs when the cell selection changes. |
SelectionChanged Event
Occurs when the cell selection changes.
public event EventHandler<Avalonia.Controls.Selection.TreeDataGridCellSelectionChangedEventArgs<T><TModel>> SelectionChanged
Remarks
This event is raised when cells are selected or deselected, either through user interaction or programmatically.