Class TreeGridCellSelectionController
Represents a class TreeGridCellSelectionController which handles the cell selection operations in SfTreeGrid when SelectionUnit is Cell.
Implements
Inherited Members
Namespace: Syncfusion.Maui.TreeGrid
Assembly: Syncfusion.Maui.TreeGrid.dll
Syntax
public class TreeGridCellSelectionController : TreeGridSelectionController, IDisposable
Remarks
The controller maintains the selected cells collection, processes the touch, keyboard and programmatic cell selection operations, and keeps the selected cell synchronized with the current cell. The existing TreeGridRowSelectionController continues to handle the row selection when SelectionUnit is Row.
Constructors
TreeGridCellSelectionController(SfTreeGrid?)
Initializes a new instance of the TreeGridCellSelectionController class.
Declaration
public TreeGridCellSelectionController(SfTreeGrid? treeGrid)
Parameters
| Type | Name | Description |
|---|---|---|
| SfTreeGrid | treeGrid | The reference of the SfTreeGrid. |
Properties
SelectedCells
Gets the collection that maintains the currently selected cells in the SfTreeGrid.
Declaration
public TreeGridSelectedCellCollection SelectedCells { get; }
Property Value
| Type |
|---|
| TreeGridSelectedCellCollection |
Remarks
The selected cells are grouped by rows. Each item holds the row data and the list of columns selected within that row.
Methods
ApplySelection(int)
Applies the cell selection to the specified row index based on the current selection mode. The column index of the current cell is used to identify the cell being selected.
Declaration
protected override bool ApplySelection(int rowIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | rowIndex | The row index in which the selection is applied. |
Returns
| Type | Description |
|---|---|
| bool | True if the selection is applied; otherwise, false. |
Overrides
ClearSelection()
Clears the current cell selection.
Declaration
public override bool ClearSelection()
Returns
| Type | Description |
|---|---|
| bool | True if the selection is cleared; otherwise, false. |
Overrides
HandleSelectionPropertyChanges(TreeGridSelectionPropertyChangedEventArgs)
Handles changes in the selection-related properties.
Declaration
public virtual void HandleSelectionPropertyChanges(TreeGridSelectionPropertyChangedEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| TreeGridSelectionPropertyChangedEventArgs | args | The selection property changed arguments. |
ProcessDownKey(int)
Processes the Down arrow key with support for Shift+Down range selection in Extended mode. For cells, Shift+Down extends the selection in the row direction within the current column.
Declaration
protected override void ProcessDownKey(int rowIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | rowIndex | The row index to navigate to. |
Overrides
ProcessLeftKey(int, int)
Processes the Left arrow key with support for Shift+Left range selection in Extended mode. For cells, Shift+Left extends the selection in the column direction within the current row.
Declaration
protected override void ProcessLeftKey(int rowIndex, int columnIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | rowIndex | The row index of the current cell. |
| int | columnIndex | The column index to navigate to. |
Overrides
ProcessRightKey(int, int)
Processes the Right arrow key with support for Shift+Right range selection in Extended mode. For cells, Shift+Right extends the selection in the column direction within the current row.
Declaration
protected override void ProcessRightKey(int rowIndex, int columnIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | rowIndex | The row index of the current cell. |
| int | columnIndex | The column index to navigate to. |
Overrides
ProcessShiftSelection(RowColumnIndex)
Processes the Shift key selection by selecting the range of cells between the current cell and the specified row and column index.
Declaration
protected void ProcessShiftSelection(RowColumnIndex rowColumnIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| RowColumnIndex | rowColumnIndex | The row and column index to extend the selection to. |
ProcessSpaceKey()
Processes the Space key for toggling the cell selection.
Declaration
protected override void ProcessSpaceKey()
Overrides
ProcessUpKey(int)
Processes the Up arrow key with support for Shift+Up range selection in Extended mode. For cells, Shift+Up extends the selection in the row direction within the current column.
Declaration
protected override void ProcessUpKey(int rowIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | rowIndex | The row index to navigate to. |
Overrides
RefreshSelectedCells()
Refreshes the row indices of the selected cells and removes the selected cells whose records are no longer available in the view.
Declaration
public void RefreshSelectedCells()
Remarks
The selection is preserved for the records that remain visible during node expansion, node collapse, and source collection changes such as add, insert, remove, reset and sort.
SelectAll()
Selects all the cells in the SfTreeGrid in multiple selection mode.
Declaration
public override bool SelectAll()
Returns
| Type | Description |
|---|---|
| bool | True if the cells are selected; otherwise, false. |
Overrides
SelectCell(object?, TreeGridColumn?)
Selects the specified cell in the SfTreeGrid.
Declaration
public void SelectCell(object? rowData, TreeGridColumn? column)
Parameters
| Type | Name | Description |
|---|---|---|
| object | rowData | The underlying data object of the row that contains the cell to select. |
| TreeGridColumn | column | The TreeGridColumn of the cell to select. |
SelectCellRange(RowColumnIndex, bool)
Selects the rectangular range of cells between the anchor (PressedRowColumnIndex) and the specified row column index for Shift and Ctrl+Shift interactions in Extended mode.
Declaration
protected override bool SelectCellRange(RowColumnIndex endRowColumnIndex, bool preserveExistingSelection)
Parameters
| Type | Name | Description |
|---|---|---|
| RowColumnIndex | endRowColumnIndex | The row column index to extend the selection to. |
| bool | preserveExistingSelection | Indicates whether to keep previous selections outside the range. |
Returns
| Type | Description |
|---|---|
| bool | True if the range selection is applied; otherwise, false. |
Overrides
SelectCells(object?, TreeGridColumn?, object?, TreeGridColumn?)
Selects the range of cells specified by the start row data, start column, end row data and end column.
Declaration
public void SelectCells(object? startRowData, TreeGridColumn? startColumn, object? endRowData, TreeGridColumn? endColumn)
Parameters
| Type | Name | Description |
|---|---|---|
| object | startRowData | The underlying data object of the row that contains the first cell in the range. |
| TreeGridColumn | startColumn | The TreeGridColumn of the first cell in the range. |
| object | endRowData | The underlying data object of the row that contains the last cell in the range. |
| TreeGridColumn | endColumn | The TreeGridColumn of the last cell in the range. |