menu

WinUI

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class GridSelectionController - WinUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class GridSelectionController

    Represents a class that implements the selection behavior of row in SfDataGrid.

    Inheritance
    System.Object
    GridBaseSelectionController
    GridSelectionController
    Implements
    IGridSelectionController
    System.ComponentModel.INotifyPropertyChanged
    System.IDisposable
    Inherited Members
    GridBaseSelectionController.AutoScrollerValueChanged(Object, AutoScrollerValueChangedEventArgs)
    GridBaseSelectionController.CanStartAutoScroller(Point, PointerRoutedEventArgs)
    GridBaseSelectionController.ChangeFlowDirectionKey(VirtualKey)
    GridBaseSelectionController.CheckIsLastRow(SfDataGrid)
    GridBaseSelectionController.ClearDetailsViewGridSelections(SfDataGrid)
    GridBaseSelectionController.ClearRowHeader()
    GridBaseSelectionController.CreateCurrentCellManager()
    GridBaseSelectionController.CurrentCellManager
    GridBaseSelectionController.DataGrid
    GridBaseSelectionController.Dispose()
    GridBaseSelectionController.Dispose(Boolean)
    GridBaseSelectionController.GetCurrentDetailsViewGrid(SfDataGrid)
    GridBaseSelectionController.GetGridSelectedRow(Int32)
    GridBaseSelectionController.HandleGridOperations(GridOperationsHandlerArgs)
    GridBaseSelectionController.HandleSelectionPropertyChanges(SelectionPropertyChangedHandlerArgs)
    GridBaseSelectionController.IsSuspended
    GridBaseSelectionController.OnPropertyChanged(String)
    GridBaseSelectionController.PressedRowColumnIndex
    GridBaseSelectionController.ProcessDetailsViewCurrentItemChanged()
    GridBaseSelectionController.ProcessOnRowHeaderChanged()
    GridBaseSelectionController.PropertyChanged
    GridBaseSelectionController.ResumeUpdates()
    GridBaseSelectionController.ScrollToRowIndex(Int32)
    GridBaseSelectionController.SelectedCells
    GridBaseSelectionController.SelectedRows
    GridBaseSelectionController.SuspendAutoScrolling
    GridBaseSelectionController.SuspendUpdates()
    GridBaseSelectionController.UnWireEvents()
    GridBaseSelectionController.WireEvents()
    Namespace: Syncfusion.UI.Xaml.DataGrid
    Assembly: Syncfusion.Grid.WinUI.dll
    Syntax
    public class GridSelectionController : GridBaseSelectionController, IGridSelectionController, INotifyPropertyChanged, IDisposable

    Constructors

    GridSelectionController(SfDataGrid)

    Initializes a new instance of the GridSelectionController class.

    Declaration
    public GridSelectionController(SfDataGrid dataGrid)
    Parameters
    Type Name Description
    SfDataGrid dataGrid

    The SfDataGrid.

    Methods

    AddSelection(List<Object>)

    Adds the row selection for the specified list of items.

    Declaration
    protected void AddSelection(List<object> addedItems)
    Parameters
    Type Name Description
    System.Collections.Generic.List<System.Object> addedItems

    The corresponding list of items to add the selection.

    ClearSelections(Boolean, Boolean)

    Clears all the selected rows in SfDataGrid.

    Declaration
    public override void ClearSelections(bool exceptCurrentRow, bool isProgrammatic = true)
    Parameters
    Type Name Description
    System.Boolean exceptCurrentRow

    Decides whether the current cell selection need to be removed when the selections are cleared.

    System.Boolean isProgrammatic

    Decides whether to raise events when the selection is cleared pogrammatically.

    Overrides
    GridBaseSelectionController.ClearSelections(Boolean, Boolean)
    Remarks

    This method helps to clear the selection programmatically.

    ClearSelections(Boolean, Boolean, Boolean)

    Clears all the selected rows in SfDataGrid.

    Declaration
    protected virtual void ClearSelections(bool exceptCurrentRow, bool isProgrammatic = true, bool removeCurrentCellSelection = true)
    Parameters
    Type Name Description
    System.Boolean exceptCurrentRow

    Decides whether the current row selection need to be removed when the selections are cleared.

    System.Boolean isProgrammatic

    Decides whether to raise events when the selection is cleared pogrammatically.

    System.Boolean removeCurrentCellSelection

    Decides whether the current cell selection need to be removed when the selections are cleared.

    CommitAddNew(Boolean)

    Commits the new item initialized on the AddNewRow to the underlying data source.

    Declaration
    protected override void CommitAddNew(bool changeState = true)
    Parameters
    Type Name Description
    System.Boolean changeState

    Indicates whether watermark should be enabled on the AddNewRow.

    Overrides
    GridBaseSelectionController.CommitAddNew(Boolean)

    ExpandOrCollapseGroup(Group, Boolean)

    Expands or collapses the group when the Right or Left arrow key is pressed.

    Declaration
    protected void ExpandOrCollapseGroup(Group group, bool isExpanded)
    Parameters
    Type Name Description
    Group group

    The corresponding group to expand or collapse.

    System.Boolean isExpanded

    Indicates the whether the group is expanded.

    GetNextRowIndex(Int32)

    Gets the index of next row corresponding to the specified index.

    Declaration
    protected virtual int GetNextRowIndex(int index)
    Parameters
    Type Name Description
    System.Int32 index

    The corresponding index to get the next row index.

    Returns
    Type Description
    System.Int32

    Returns the index of next row.

    GetPreviousRowIndex(Int32)

    Gets the index of previous row corresponding to the specified index.

    Declaration
    protected virtual 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.

    GetRowInfo()

    Gets the row informations.

    Declaration
    public List<GridRowInfo> GetRowInfo()
    Returns
    Type Description
    System.Collections.Generic.List<GridRowInfo>

    The list of row information.

    HandleCollectionChanged(NotifyCollectionChangedEventArgs, CollectionChangedReason)

    Handles the row selection when the collection changes on SelectedItems, Columns and DataSource properties in SfDataGrid.

    Declaration
    public override void HandleCollectionChanged(NotifyCollectionChangedEventArgs e, CollectionChangedReason reason)
    Parameters
    Type Name Description
    System.Collections.Specialized.NotifyCollectionChangedEventArgs e

    The System.Collections.Specialized.NotifyCollectionChangedEventArgs that contains data for collection changes.

    CollectionChangedReason reason

    Contains the CollectionChangedReason for collection changes.

    Overrides
    GridBaseSelectionController.HandleCollectionChanged(NotifyCollectionChangedEventArgs, CollectionChangedReason)
    Remarks

    This method is called when the collection changes on SelectedItems, Columns and DataSource properties in SfDataGrid.

    HandleDetailsViewGridKeyDown(KeyRoutedEventArgs)

    Handles the row selection when the keyboard interactions that are performed in DetailsViewDataGrid.

    Declaration
    public override bool HandleDetailsViewGridKeyDown(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 DetailsViewDataGrid; otherwise, false.

    Overrides
    GridBaseSelectionController.HandleDetailsViewGridKeyDown(KeyRoutedEventArgs)

    HandleGroupExpandCollapse(Int32, Int32, Boolean)

    Handles the row selection when the group is expanded or collapsed in SfDataGrid.

    Declaration
    public override void HandleGroupExpandCollapse(int index, int count, bool isExpanded)
    Parameters
    Type Name Description
    System.Int32 index

    The corresponding index of the group.

    System.Int32 count

    The number of rows that are collapsed or expanded.

    System.Boolean isExpanded

    Specifies whether the group is expanded or not.

    Overrides
    GridBaseSelectionController.HandleGroupExpandCollapse(Int32, Int32, Boolean)
    Remarks

    This method is invoked when the group is expanded or collapsed.

    HandleKeyDown(KeyRoutedEventArgs)

    Handles the row selection when the keyboard interactions that are performed in SfDataGrid.

    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 SfDataGrid; otherwise, false.

    Overrides
    GridBaseSelectionController.HandleKeyDown(KeyRoutedEventArgs)

    HandlePointerOperations(GridPointerEventArgs, RowColumnIndex)

    Handles the row selection when any of PointerOperation such as pressed, released, moved, and etc that are performed in SfDataGrid.

    Declaration
    public override void HandlePointerOperations(GridPointerEventArgs args, RowColumnIndex rowColumnIndex)
    Parameters
    Type Name Description
    GridPointerEventArgs args

    The GridPointerEventArgs that contains the type of pointer operations and its arguments.

    RowColumnIndex rowColumnIndex

    The corresponding rowColumnIndex to handle pointer operation in row.

    Overrides
    GridBaseSelectionController.HandlePointerOperations(GridPointerEventArgs, RowColumnIndex)
    Remarks

    This method is invoked when any of the PointerOperation are performed in SfDataGrid.

    HideAllRowSelectionBorder(Boolean)

    Hides the row selection border for all rows in SfDataGrid.

    Declaration
    protected void HideAllRowSelectionBorder(bool exceptCurrentRow)
    Parameters
    Type Name Description
    System.Boolean exceptCurrentRow

    Indicates whether the selection border should be hidden except for current row.

    MoveCurrentCell(RowColumnIndex, Boolean)

    Moves the current cell for 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
    GridBaseSelectionController.MoveCurrentCell(RowColumnIndex, Boolean)
    Remarks

    This method is not applicable when the SelectionUnit and 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
    GridBaseSelectionController.ProcessCurrentItemChanged(SelectionPropertyChangedHandlerArgs)

    ProcessDataReorder(Object, NotifyCollectionChangedAction)

    Processes the row selection when the data is reordered in SfDataGrid.

    Declaration
    protected virtual void ProcessDataReorder(object value, NotifyCollectionChangedAction action)
    Parameters
    Type Name Description
    System.Object value

    The corresponding value to check whether the reordered data that contains selection.

    System.Collections.Specialized.NotifyCollectionChangedAction action

    Indicates the corresponding collection changed actions performed on the data.

    ProcessDetailsViewGridPointerMoved(PointerRoutedEventArgs, RowColumnIndex)

    Processes the row selection when mouse pointer moved on the DetailsViewDataGrid.

    Declaration
    protected virtual void ProcessDetailsViewGridPointerMoved(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 in DetailsViewDataGrid.

    ProcessDetailsViewGridPointerPressed(PointerRoutedEventArgs, RowColumnIndex)

    Processes the row selection when the mouse pointer is pressed on the DetailsViewDataGrid.

    Declaration
    protected virtual void ProcessDetailsViewGridPointerPressed(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 pressed point.

    Remarks

    This method invoked when the mouse point is pressed using touch or mouse in DetailsViewDataGrid.

    ProcessDetailsViewGridPointerReleased(PointerRoutedEventArgs, RowColumnIndex)

    Processes the row selection when the mouse pointer is released from the DetailsViewDataGrid.

    Declaration
    protected virtual void ProcessDetailsViewGridPointerReleased(PointerRoutedEventArgs args, RowColumnIndex rowColumnIndex)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs args

    Contains the data for mouse pointer related changes.

    RowColumnIndex rowColumnIndex

    The corresponding rowColumnIndex of the mouse released point.

    ProcessDetailsViewIndex(KeyRoutedEventArgs, Int32, VirtualKey, out Int32)

    Processes the row selection while navigating the cell from parent grid to child grid.

    Declaration
    protected bool ProcessDetailsViewIndex(KeyRoutedEventArgs args, int rowIndex, VirtualKey processKey, out int returnIndex)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.KeyRoutedEventArgs args

    Contains data for key navigation.

    System.Int32 rowIndex

    The corresponding row index where the key navigation occurs.

    Windows.System.VirtualKey processKey

    The corresponding key that was processed.

    System.Int32 returnIndex

    The returnIndex to select the next row when DetailsViewDataGrid doesn't handle the cell selection.

    Returns
    Type Description
    System.Boolean

    Returns true if the pressed key was processed in DetailsViewDataGrid; otherwise, false.

    ProcessDetailsViewKeyDown(KeyRoutedEventArgs, ref Int32, VirtualKey)

    Processes the row selection when the keyboard interactions that are performed in DetailsViewDataGrid.

    Declaration
    protected bool ProcessDetailsViewKeyDown(KeyRoutedEventArgs args, ref int rowIndex, VirtualKey processKey)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.KeyRoutedEventArgs args

    Contains data for key navigation.

    System.Int32 rowIndex

    The corresponding row index where the key navigation occurs.

    Windows.System.VirtualKey processKey

    The corresponding key that was processed.

    Returns
    Type Description
    System.Boolean

    Returns true if the keyboard interaction that are processed in DetailsViewDataGrid; otherwise, false.

    ProcessDragSelection(PointerRoutedEventArgs, RowColumnIndex)

    Processes the row selection when the mouse pointer is dragged on the SfDataGrid.

    Declaration
    protected override void ProcessDragSelection(PointerRoutedEventArgs args, RowColumnIndex rowColumnIndex)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs args

    Contains information about the mouse related operations.

    RowColumnIndex rowColumnIndex

    The starting rowColumnIndex of the drag selection.

    Overrides
    GridBaseSelectionController.ProcessDragSelection(PointerRoutedEventArgs, RowColumnIndex)
    Remarks

    This method will be raised when the SelectionMode is Multiple or Extended.

    ProcessGroupCollapsed(Int32, Int32)

    Processes the row selection when the group is collapsed from view.

    Declaration
    protected virtual void ProcessGroupCollapsed(int removeAtIndex, int count)
    Parameters
    Type Name Description
    System.Int32 removeAtIndex

    The corresponding index of the group that is collapsed from the view.

    System.Int32 count

    The number of collapsed rows count.

    ProcessGroupExpanded(Int32, Int32)

    Processes the row selection when the group is expanded in SfDataGrid.

    Declaration
    protected virtual void ProcessGroupExpanded(int insertIndex, int count)
    Parameters
    Type Name Description
    System.Int32 insertIndex

    The corresponding index of the group that is expanded in to view.

    System.Int32 count

    The number of expanded rows count.

    ProcessKeyDown(KeyRoutedEventArgs)

    Processes the row selection when the keyboard interactions that are performed in SfDataGrid.

    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 SfDataGrid.

    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
    GridBaseSelectionController.ProcessNavigationModeChanged(SelectionPropertyChangedHandlerArgs)

    ProcessOnAddNewRow(AddNewRowOperationHandlerArgs)

    Processes the row selection when new row is initiated or committed and the position of AddNewRow is changed.

    Declaration
    protected override void ProcessOnAddNewRow(AddNewRowOperationHandlerArgs handle)
    Parameters
    Type Name Description
    AddNewRowOperationHandlerArgs handle

    Contains data for the AddNewRow operation.

    Overrides
    GridBaseSelectionController.ProcessOnAddNewRow(AddNewRowOperationHandlerArgs)

    ProcessOnDoubleTapped(DoubleTappedRoutedEventArgs, RowColumnIndex)

    Processes the selection when the mouse point is double tapped on the particular cell in a row.

    Declaration
    protected virtual void ProcessOnDoubleTapped(DoubleTappedRoutedEventArgs e, RowColumnIndex currentRowColumnIndex)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.DoubleTappedRoutedEventArgs e

    Contains the data related to the double tap interaction.

    RowColumnIndex currentRowColumnIndex

    The corresponding rowColumnIndex of the mouse point.

    Remarks

    This method invoked to process selection and end edit the cell when EditTrigger is OnDoubleTap.

    ProcessOnFilterApplied(GridFilteringEventArgs)

    Processes the row selection when filtering is applied in SfDataGrid.

    Declaration
    protected override void ProcessOnFilterApplied(GridFilteringEventArgs args)
    Parameters
    Type Name Description
    GridFilteringEventArgs args

    Contains the data related to filtering operation.

    Overrides
    GridBaseSelectionController.ProcessOnFilterApplied(GridFilteringEventArgs)

    ProcessOnFilterPopupOpened()

    Processes the row selection when the filter popup is opened.

    Declaration
    protected override void ProcessOnFilterPopupOpened()
    Overrides
    GridBaseSelectionController.ProcessOnFilterPopupOpened()
    Remarks

    This method refreshes the row selection while opening the filter popup in SfDataGrid.

    ProcessOnFilterRowPositionChanged(DependencyPropertyChangedEventArgs)

    Processes the selection when the position of FilterRow is changed.

    Declaration
    protected override void ProcessOnFilterRowPositionChanged(DependencyPropertyChangedEventArgs args)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.DependencyPropertyChangedEventArgs args

    Contains data for the FilterRow position changed.

    Overrides
    GridBaseSelectionController.ProcessOnFilterRowPositionChanged(DependencyPropertyChangedEventArgs)

    ProcessOnGroupChanged(GridGroupingEventArgs)

    Processes the row selection when the column is grouped in SfDataGrid.

    Declaration
    protected override void ProcessOnGroupChanged(GridGroupingEventArgs args)
    Parameters
    Type Name Description
    GridGroupingEventArgs args

    Contains the data related to the grouping operation.

    Overrides
    GridBaseSelectionController.ProcessOnGroupChanged(GridGroupingEventArgs)
    Remarks

    This method refreshes the selection while grouping the column in SfDataGrid.

    ProcessOnPageChanged()

    Processes the row selection while navigating from one page in to another page in SfDataPager.

    Declaration
    protected override void ProcessOnPageChanged()
    Overrides
    GridBaseSelectionController.ProcessOnPageChanged()

    ProcessOnPaste(List<Object>)

    Processes the row selection when the records is pasted from the clipboard into SfDataGrid.

    Declaration
    protected override void ProcessOnPaste(List<object> records)
    Parameters
    Type Name Description
    System.Collections.Generic.List<System.Object> records

    Contains the list of records that is pasted into SfDataGrid.

    Overrides
    GridBaseSelectionController.ProcessOnPaste(List<Object>)

    ProcessOnSortChanged(SortColumnChangedHandle)

    Processes the row selection when the column is sorted in SfDataGrid.

    Declaration
    protected override void ProcessOnSortChanged(SortColumnChangedHandle sortcolumnHandle)
    Parameters
    Type Name Description
    SortColumnChangedHandle sortcolumnHandle

    Contains information related to the sorting action.

    Overrides
    GridBaseSelectionController.ProcessOnSortChanged(SortColumnChangedHandle)
    Remarks

    This method refreshes the selection while sorting the column in SfDataGrid and clear the selection in summary rows.

    ProcessOnStackedHeaderRows(StackedHeaderCollectionChangedEventArgs)

    Processes the cell selection when the stacked header collection changes in SfDataGrid.

    Declaration
    protected override void ProcessOnStackedHeaderRows(StackedHeaderCollectionChangedEventArgs args)
    Parameters
    Type Name Description
    StackedHeaderCollectionChangedEventArgs args

    Contains data for stacked header collection changes.

    Overrides
    GridBaseSelectionController.ProcessOnStackedHeaderRows(StackedHeaderCollectionChangedEventArgs)

    ProcessOnTapped(TappedRoutedEventArgs, RowColumnIndex)

    Processes the row selection when the mouse point is tapped on the particular cell in a row.

    Declaration
    protected virtual 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.

    Remarks

    This method invoked to process selection and end edit the cell when EditTrigger is OnTap.

    ProcessPointerMoved(PointerRoutedEventArgs, RowColumnIndex)

    Processes the row selection when mouse pointer is moved on the SfDataGrid.

    Declaration
    protected virtual 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.

    ProcessPointerPressed(PointerRoutedEventArgs, RowColumnIndex)

    Processes the row selection when the mouse pointer is pressed in SfDataGrid.

    Declaration
    protected virtual 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.

    Remarks

    This method will be invoked when the pointer is pressed using touch or mouse in SfDataGrid. 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 SfDataGrid.

    Declaration
    protected virtual 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.

    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 that are performed in SfDataGrid.

    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 row 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
    GridBaseSelectionController.ProcessSelectedIndexChanged(SelectionPropertyChangedHandlerArgs)

    ProcessSelectedItemChanged(SelectionPropertyChangedHandlerArgs)

    Processes the row 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
    GridBaseSelectionController.ProcessSelectedItemChanged(SelectionPropertyChangedHandlerArgs)

    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(Int32, RowColumnIndex, SelectionReason)

    Processes the row selection for the specified row index.

    Declaration
    protected bool ProcessSelection(int rowIndex, RowColumnIndex previousCurrentCellIndex, SelectionReason reason)
    Parameters
    Type Name Description
    System.Int32 rowIndex

    The corresponding index to select the row.

    RowColumnIndex previousCurrentCellIndex

    The corresponding previous current cell index.

    SelectionReason reason

    Contains the reason for process selection.

    Returns
    Type Description
    System.Boolean

    Returns true if the cell selection is processed 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
    GridBaseSelectionController.ProcessSelectionModeChanged(SelectionPropertyChangedHandlerArgs)

    ProcessShiftSelection(Int32)

    Processes the row selection when the rows selected by using Shift key.

    Declaration
    protected void ProcessShiftSelection(int rowIndex)
    Parameters
    Type Name Description
    System.Int32 rowIndex

    The corresponding row index to perform Shift selection.

    ProcessSourceCollectionChanged(NotifyCollectionChangedEventArgs, CollectionChangedReason)

    Processes the row selection when the ItemsSource property value changes.

    Declaration
    protected virtual void ProcessSourceCollectionChanged(NotifyCollectionChangedEventArgs e, CollectionChangedReason reason)
    Parameters
    Type Name Description
    System.Collections.Specialized.NotifyCollectionChangedEventArgs e

    The System.Collections.Specialized.NotifyCollectionChangedEventArgs that contains data for source collection changes.

    CollectionChangedReason reason

    The CollectionChangedReason contains reason for the source collection changes.

    ProcessTableSummaryChanged(TableSummaryPositionChangedEventArgs)

    Processes the row selection when the table summary row position has changed.

    Declaration
    protected override void ProcessTableSummaryChanged(TableSummaryPositionChangedEventArgs args)
    Parameters
    Type Name Description
    TableSummaryPositionChangedEventArgs args

    Contains the data for the table summary row position changes.

    Overrides
    GridBaseSelectionController.ProcessTableSummaryChanged(TableSummaryPositionChangedEventArgs)

    ProcessUnboundRowChanged(UnboundDataRowCollectionChangedEventArgs)

    Processes the row selection when the UnboundRow collection changes.

    Declaration
    protected override void ProcessUnboundRowChanged(UnboundDataRowCollectionChangedEventArgs args)
    Parameters
    Type Name Description
    UnboundDataRowCollectionChangedEventArgs args

    Contains data for the UnboundRow collection changes.

    Overrides
    GridBaseSelectionController.ProcessUnboundRowChanged(UnboundDataRowCollectionChangedEventArgs)

    RefreshSelectedItems(ref List<Object>)

    Refreshes the SelectedItems collection in SfDataGrid.

    Declaration
    protected void RefreshSelectedItems(ref List<object> removedItems)
    Parameters
    Type Name Description
    System.Collections.Generic.List<System.Object> removedItems

    Returns removeditems

    Remarks

    This method refresh the SelectedItems collection when the grid related operations performed.

    RefreshSelectedRows()

    Refreshes the SelectedRows collection in SfDataGrid.

    Declaration
    protected void RefreshSelectedRows()
    Remarks

    This method refresh the SelectedRows collection when the grid related operations are performed.

    RemoveRows()

    Removes the selected rows from the SfDataGrid control.

    Declaration
    protected bool RemoveRows()
    Returns
    Type Description
    System.Boolean

    Returns true if the selected rows removed; otherwise false.

    RemoveSelection(List<Object>, Boolean)

    Removes the selection for the specified list of items.

    Declaration
    protected void RemoveSelection(List<object> removedItems, bool needToRemoveSameRow = false)
    Parameters
    Type Name Description
    System.Collections.Generic.List<System.Object> removedItems

    The corresponding list of items to remove the selection.

    System.Boolean needToRemoveSameRow

    Indicates whether the selection need to be removed for the same row.

    ResetSelectedRows(Boolean)

    Resets the SelectedRows based on the selection added or removed in SfDataGrid.

    Declaration
    public void ResetSelectedRows(bool canUpdateCurrentRow = true)
    Parameters
    Type Name Description
    System.Boolean canUpdateCurrentRow

    Indicates whether the current row is updated based on CurrentItem.

    Remarks

    The SelectedRows collection updated only for data rows and other selection will be removed from SfDataGrid.

    ResetSelection(Int32, List<Object>, Boolean)

    Resets the row selection for the specified row index and list of removed items.

    Declaration
    protected void ResetSelection(int rowIndex, List<object> removedItems, bool setFocuForGrid = true)
    Parameters
    Type Name Description
    System.Int32 rowIndex

    The corresponding row index to reset the selection

    System.Collections.Generic.List<System.Object> removedItems

    The list of items to reset the selection.

    System.Boolean setFocuForGrid

    Indicates whether the focus is set to SfDataGrid or not.

    SelectAll(Boolean)

    Selects all the rows in SfDataGrid.

    Declaration
    public override void SelectAll(bool canFocus = true)
    Parameters
    Type Name Description
    System.Boolean canFocus

    Decides whether the focus can be set to the current cell.

    Overrides
    GridBaseSelectionController.SelectAll(Boolean)
    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
    GridBaseSelectionController.SelectRows(Int32, Int32)

    SetPressedIndex(RowColumnIndex)

    Sets the PressedRowColumnIndex of SfDataGird.

    Declaration
    protected override void SetPressedIndex(RowColumnIndex rowcolumnIndex)
    Parameters
    Type Name Description
    RowColumnIndex rowcolumnIndex

    Indicates the starting position of drag selection.

    Overrides
    GridBaseSelectionController.SetPressedIndex(RowColumnIndex)
    Remarks

    This method helps to initialize the starting position of drag selection.

    ShowAllRowSelectionBorder()

    Shows the selection border for all rows in SfDataGrid.

    Declaration
    protected void ShowAllRowSelectionBorder()

    UpdateCurrentRowIndex(Boolean, Boolean)

    Updates the current row index based on CurrentItem property value changes.

    Declaration
    protected void UpdateCurrentRowIndex(bool skipIfNotDataRow = true, bool canFocusGrid = true)
    Parameters
    Type Name Description
    System.Boolean skipIfNotDataRow

    Indicates whether the current row index skipped other than the data row.

    System.Boolean canFocusGrid

    Indicates the SfDataGrid can be focused after the current row index is updated.

    Implements

    IGridSelectionController
    System.ComponentModel.INotifyPropertyChanged
    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved