Class TreeGridRowSelectionController
Represents a class that implements the selection behavior of row in SfTreeGrid.
Inheritance
Inherited Members
Namespace: Syncfusion.UI.Xaml.TreeGrid
Assembly: Syncfusion.Grid.WinUI.dll
Syntax
public class TreeGridRowSelectionController : TreeGridBaseSelectionController, ITreeGridSelectionController, IDisposable
Constructors
TreeGridRowSelectionController(SfTreeGrid)
Initializes a new instance of the TreeGridRowSelectionController class.
Declaration
public TreeGridRowSelectionController(SfTreeGrid treeGrid)
Parameters
Type | Name | Description |
---|---|---|
SfTreeGrid | treeGrid | The SfTreeGrid. |
Methods
ClearSelections(Boolean)
Clears all the selected rows in SfTreeGrid.
Declaration
public override void ClearSelections(bool exceptCurrentRow)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | exceptCurrentRow | Decides whether the current row selection needs to be removed when the selections are cleared. |
Overrides
Remarks
This method helps to clear the selection programmatically.
GetNextRowIndex(Int32)
Gets the index of the next row corresponding to the specified row index.
Declaration
protected int GetNextRowIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The corresponding index to get the index of next row. |
Returns
Type | Description |
---|---|
System.Int32 | The index of next row; Returns , -1 when the row index is last row index. |
GetPreviousRowIndex(Int32)
Gets the index of previous row corresponding to the specified index.
Declaration
protected int GetPreviousRowIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The corresponding index to get the previous row index. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the index of previous row. |
HandleCollectionChanged(NotifyCollectionChangedEventArgs, TreeGridCollectionChangedReason)
Handles the selection when the SelectedItems, Columns and DataSource property collection changes.
Declaration
public override void HandleCollectionChanged(NotifyCollectionChangedEventArgs e, TreeGridCollectionChangedReason reason)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Specialized.NotifyCollectionChangedEventArgs | e | The System.Collections.Specialized.NotifyCollectionChangedEventArgs that contains data for collection changes. |
TreeGridCollectionChangedReason | reason | The TreeGridCollectionChangedReason contains reason for the collection changes. |
Overrides
Remarks
This method is called when the collection changes on SelectedItems, Columns and DataSource properties in SfTreeGrid.
HandleKeyDown(KeyRoutedEventArgs)
Handles the selection for the keyboard interactions that are performed in SfTreeGrid.
Declaration
public override bool HandleKeyDown(KeyRoutedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.Input.KeyRoutedEventArgs | args | Contains information about the key that was pressed. |
Returns
Type | Description |
---|---|
System.Boolean | true if the key should be handled in SfTreeGrid; otherwise, false. |
Overrides
HandleNodeExpandCollapse(Int32, Int32, Boolean)
Handles the selection when the node is expanded or collapsed in SfTreeGrid.
Declaration
public override void HandleNodeExpandCollapse(int index, int count, bool isExpanded)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The corresponding index of the node. |
System.Int32 | count | The number of rows that are collapsed or expanded. |
System.Boolean | isExpanded | Specifies whether the node is expanded or not. |
Overrides
Remarks
This method is invoked when the node is expanded or collapsed.
HandleNodeOperations(NodeOperation)
Processes the selection when the node is expanded/collapsed in SfTreeGrid.
Declaration
protected override void HandleNodeOperations(NodeOperation NodeOperation)
Parameters
Type | Name | Description |
---|---|---|
NodeOperation | NodeOperation | Contains the value for collection changes during expanding/collapsing action. |
Overrides
Remarks
This method refreshes the selection while expanding/collapsing the node in SfTreeGrid.
MoveCurrentCell(RowColumnIndex, Boolean)
Moves the current cell to the specified rowColumnIndex.
Declaration
public override void MoveCurrentCell(RowColumnIndex rowColumnIndex, bool needToClearSelection = true)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | rowColumnIndex | Specifies the corresponding rowColumnIndex to move the current cell. |
System.Boolean | needToClearSelection | Decides whether the current row selection should remove or not while moving the current cell. |
Overrides
Remarks
This method is not applicable when NavigationMode is Row.
ProcessCurrentItemChanged(SelectionPropertyChangedHandlerArgs)
Processes the row selection when the CurrentItem property value changes.
Declaration
protected override void ProcessCurrentItemChanged(SelectionPropertyChangedHandlerArgs handle)
Parameters
Type | Name | Description |
---|---|---|
SelectionPropertyChangedHandlerArgs | handle | The SelectionPropertyChangedHandlerArgs contains the data for the CurrentItem property value changes. |
Overrides
ProcessKeyDown(KeyRoutedEventArgs)
Processes the row selection when the keyboard interactions that are performed in SfTreeGrid.
Declaration
protected virtual void ProcessKeyDown(KeyRoutedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.Input.KeyRoutedEventArgs | args | Contains the information about the key that was pressed. |
Remarks
This method helps to customize the keyboard interaction behavior in SfTreeGrid.
ProcessNavigationModeChanged(SelectionPropertyChangedHandlerArgs)
Processes the row selection when the NavigationMode property value changes.
Declaration
protected override void ProcessNavigationModeChanged(SelectionPropertyChangedHandlerArgs handle)
Parameters
Type | Name | Description |
---|---|---|
SelectionPropertyChangedHandlerArgs | handle | The SelectionPropertyChangedHandlerArgs contains the data for the NavigationMode property value changes. |
Overrides
ProcessNodeCollapsed(Int32, Int32)
Processes the row selection when the node is collapsed from view.
Declaration
protected virtual void ProcessNodeCollapsed(int removeAtIndex, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | removeAtIndex | The corresponding index of the node that is collapsed from the view. |
System.Int32 | count | removed rows count. |
ProcessNodeExpanded(Int32, Int32)
Processes the row selection when the node is expanded in SfTreeGrid.
Declaration
protected virtual void ProcessNodeExpanded(int insertIndex, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | insertIndex | The corresponding index of the node that is expanded in to view. |
System.Int32 | count | inserted rows count. |
ProcessOnDoubleTapped(RowColumnIndex)
Processes the selection when the mouse point is double tapped on the particular cell in SfTreeGrid.
Declaration
protected override void ProcessOnDoubleTapped(RowColumnIndex currentRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | currentRowColumnIndex | The corresponding rowColumnIndex of the mouse point. |
Overrides
Remarks
This method invoked to process selection and begin edit the cell when EditTrigger is OnDoubleTap.
ProcessOnSortChanged(SortColumnChangedHandle)
Processes the row selection when the column is sorted in SfTreeGrid.
Declaration
protected override void ProcessOnSortChanged(SortColumnChangedHandle sortcolumnHandle)
Parameters
Type | Name | Description |
---|---|---|
SortColumnChangedHandle | sortcolumnHandle | Contains information related to the sorting action. |
Overrides
Remarks
This method refreshes the selection while sorting the column in SfTreeGrid.
ProcessOnTapped(TappedRoutedEventArgs, RowColumnIndex)
Processes the cell selection when the mouse point is tapped on the TreeGridCell.
Declaration
protected override void ProcessOnTapped(TappedRoutedEventArgs e, RowColumnIndex currentRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.Input.TappedRoutedEventArgs | e | Contains the data related to the tap interaction. |
RowColumnIndex | currentRowColumnIndex | The corresponding rowColumnIndex of the mouse point. |
Overrides
Remarks
This method invoked to process selection and begin edit the cell when EditTrigger is OnTap.
ProcessPointerMoved(PointerRoutedEventArgs, RowColumnIndex)
Processes the row selection when mouse pointer is moved on the SfTreeGrid.
Declaration
protected override void ProcessPointerMoved(PointerRoutedEventArgs args, RowColumnIndex rowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.Input.PointerRoutedEventArgs | args | Contains the data for mouse related interaction. |
RowColumnIndex | rowColumnIndex | The corresponding rowColumnIndex related to the mouse point. |
Overrides
ProcessPointerPressed(PointerRoutedEventArgs, RowColumnIndex)
Processes the row selection when the mouse pointer is pressed in SfTreeGrid.
Declaration
protected override void ProcessPointerPressed(PointerRoutedEventArgs args, RowColumnIndex rowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.Input.PointerRoutedEventArgs | args | Contains the data for mouse pointer action. |
RowColumnIndex | rowColumnIndex | The corresponding rowColumnIndex of the pressed point location. |
Overrides
Remarks
This method will be invoked when the pointer is pressed using touch or mouse in SfTreeGrid. The selection is initialized in pointer pressed state when the AllowSelectionOnPointerPressed set as true.
ProcessPointerReleased(PointerRoutedEventArgs, RowColumnIndex)
Processes the row selection when the mouse pointer is released from SfTreeGrid.
Declaration
protected override void ProcessPointerReleased(PointerRoutedEventArgs args, RowColumnIndex rowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.Input.PointerRoutedEventArgs | args | Contains the data for mouse pointer action. |
RowColumnIndex | rowColumnIndex | The corresponding rowColumnIndex of the mouse released point. |
Overrides
Remarks
The selection is initialized in pointer released state when the AllowSelectionOnPointerPressed set as false.
ProcessPointerSelection(PointerRoutedEventArgs, RowColumnIndex)
Processes the row selection when the pointer pressed or released interactions are performed in SfTreeGrid.
Declaration
protected void ProcessPointerSelection(PointerRoutedEventArgs args, RowColumnIndex rowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.UI.Xaml.Input.PointerRoutedEventArgs | args | Contains the data for mouse pointer action. |
RowColumnIndex | rowColumnIndex | The corresponding rowColumnIndex related to the mouse point. |
ProcessSelectedIndexChanged(SelectionPropertyChangedHandlerArgs)
Processes the selection when the SelectedIndex property value changes.
Declaration
protected override void ProcessSelectedIndexChanged(SelectionPropertyChangedHandlerArgs handle)
Parameters
Type | Name | Description |
---|---|---|
SelectionPropertyChangedHandlerArgs | handle | The SelectionPropertyChangedHandlerArgs contains the data for the SelectedIndex property value changes. |
Overrides
ProcessSelectedItemChanged(SelectionPropertyChangedHandlerArgs)
Processes the selection when the SelectedItem property value changes.
Declaration
protected override void ProcessSelectedItemChanged(SelectionPropertyChangedHandlerArgs handle)
Parameters
Type | Name | Description |
---|---|---|
SelectionPropertyChangedHandlerArgs | handle | The SelectionPropertyChangedHandlerArgs contains the data for the SelectedItem property value changes. |
Overrides
ProcessSelectedItemsChanged(NotifyCollectionChangedEventArgs)
Processes the row selection when the SelectedItems property value changes.
Declaration
protected virtual void ProcessSelectedItemsChanged(NotifyCollectionChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Specialized.NotifyCollectionChangedEventArgs | e | The System.Collections.Specialized.NotifyCollectionChangedEventArgs that contains data for SelectedItems collection changes. |
ProcessSelection(RowColumnIndex, RowColumnIndex, SelectionReason)
Processes the row selection for the specified row index.
Declaration
protected virtual bool ProcessSelection(RowColumnIndex rowColumnIndex, RowColumnIndex previousCurrentCellIndex, SelectionReason reason)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | rowColumnIndex | The row column index. |
RowColumnIndex | previousCurrentCellIndex | The previous current cell row column index. |
SelectionReason | reason | Contains the reason for process selection SelectionReason. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the selection is added to corresponding row and column index; otherwise, false. |
ProcessSelectionModeChanged(SelectionPropertyChangedHandlerArgs)
Processes the row selection when the SelectionMode property value changes.
Declaration
protected override void ProcessSelectionModeChanged(SelectionPropertyChangedHandlerArgs handle)
Parameters
Type | Name | Description |
---|---|---|
SelectionPropertyChangedHandlerArgs | handle | The SelectionPropertyChangedHandlerArgs contains the data for the SelectionMode property changes. |
Overrides
ProcessSourceCollectionChanged(NotifyCollectionChangedEventArgs, TreeGridCollectionChangedReason)
Processes the row selection when the ItemsSource property collection changes.
Declaration
protected virtual void ProcessSourceCollectionChanged(NotifyCollectionChangedEventArgs e, TreeGridCollectionChangedReason reason)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Specialized.NotifyCollectionChangedEventArgs | e | The System.Collections.Specialized.NotifyCollectionChangedEventArgs that contains data for source collection changes. |
TreeGridCollectionChangedReason | reason | The TreeGridCollectionChangedReason contains reason for the source collection changes. |
RefreshSelectedItems()
Refreshes the SelectedItems collection in SfTreeGrid.
Declaration
protected virtual void RefreshSelectedItems()
Remarks
This method refresh the SelectedItems collection when the grid related operations performed.
RefreshSelection()
Refreshes the selected index, selected item, selected items and current item of SfTreeGrid.
Declaration
public void RefreshSelection()
SelectAll()
Selects all the rows in SfTreeGrid.
Declaration
public override void SelectAll()
Overrides
Remarks
This method only works for Multiple and Extended mode selection.
SelectRows(Int32, Int32)
Selects the rows corresponding to the specified start and end index of the row.
Declaration
public override void SelectRows(int startRowIndex, int endRowIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startRowIndex | The start index of the row. |
System.Int32 | endRowIndex | The end index of the row. |
Overrides
Remarks
This method only works for Multiple and Extended mode selection.
UpdateCurrentRowIndex(Boolean)
Updates the current row index based on CurrentItem property value changes.
Declaration
protected void UpdateCurrentRowIndex(bool canFocusGrid = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | canFocusGrid | Indicates the SfTreeGrid can be focused after the current row index is updated. |