Class GridBaseSelectionController
Provides the base implementation for selection in SfDataGrid.
Inheritance
Namespace: Syncfusion.UI.Xaml.Grid
Assembly: Syncfusion.SfGrid.WPF.dll
Syntax
public abstract class GridBaseSelectionController : Object, IGridSelectionController, INotifyPropertyChanged, IDisposable
Constructors
GridBaseSelectionController(SfDataGrid)
Initializes a new instance of GridBaseSelectionController class.
Declaration
public GridBaseSelectionController(SfDataGrid dataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The corresponding SfDataGrid instance. |
Fields
currentKey
Gets or sets the currently pressed key.
Declaration
protected Key currentKey
Field Value
Type |
---|
System.Windows.Input.Key |
lastPressedKey
Gets or sets the last pressed key.
Declaration
protected Key lastPressedKey
Field Value
Type |
---|
System.Windows.Input.Key |
Properties
CurrentCellManager
Gets the reference to the GridCurrentCellManager instance which holds the current cell information.
Declaration
public GridCurrentCellManager CurrentCellManager { get; protected set; }
Property Value
Type |
---|
GridCurrentCellManager |
Remarks
GridCurrentCellManager creates the current cell and manages the current cell related operations.
DataGrid
Gets or sets the reference to the SfDataGrid control.
Declaration
public SfDataGrid DataGrid { get; protected set; }
Property Value
Type | Description |
---|---|
SfDataGrid | The reference to the SfDataGrid control. |
GroupRowSelectionBrush
Gets or sets a brush that highlights the background of currently selected group caption and group summary rows.
Declaration
public Brush GroupRowSelectionBrush { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Media.Brush | The brush that highlights the background of currently selected group row. |
IsSuspended
Gets or sets a value to suspend the selection operations that are performed internally.
Declaration
public bool IsSuspended { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the selection operations is suspended; otherwise , false. |
PressedRowColumnIndex
Gets or sets the pressed RowColumnIndex of SfDataGrid.
Declaration
protected RowColumnIndex PressedRowColumnIndex { get; set; }
Property Value
Type |
---|
RowColumnIndex |
RowHoverBackgroundBrush
Gets or sets a brush that highlights the background of data row is being hovered.
Declaration
public Brush RowHoverBackgroundBrush { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Media.Brush | The brush that highlights the data row is being hovered. |
RowSelectionBrush
Gets or sets a brush that highlights the background of the currently selected row or cell.
Declaration
public Brush RowSelectionBrush { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Media.Brush | The brush that highlights the background of the selected row or cell. |
SelectedCells
Gets or sets the collection of
Declaration
public GridSelectedCellsCollection SelectedCells { get; protected set; }
Property Value
Type | Description |
---|---|
GridSelectedCellsCollection | The collection of |
SelectedRows
Gets or sets the collection of GridRowInfo that contains the information of selected rows.
Declaration
public GridSelectedRowsCollection SelectedRows { get; protected set; }
Property Value
Type | Description |
---|---|
GridSelectedRowsCollection | The collection of GridRowInfo. |
SuspendAutoScrolling
Gets or sets a value that indicates whether the drag selection is disabled or not.
Declaration
public bool SuspendAutoScrolling { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the drag selection is disabled in SfDataGrid; otherwise ,false. |
Methods
AutoScrollerValueChanged(Object, AutoScrollerValueChangedEventArgs)
Invoked when the selection is dragged out of view area in SfDataGrid.
Declaration
protected virtual void AutoScrollerValueChanged(object sender, AutoScrollerValueChangedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The sender that contains the SfDataGrid. |
AutoScrollerValueChangedEventArgs | args | Contains the event data. |
CanStartAutoScroller(Point, MouseEventArgs)
Determines whether the auto scroller is enabled when the drag selection reaches the out of visible boundaries in SfDataGrid.
Declaration
protected bool CanStartAutoScroller(Point point, MouseEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Point | point | Represents the corresponding position of mouse to decide whether the selection is dragged out of view in SfDataGrid. |
System.Windows.Input.MouseEventArgs | args | Contains the data for mouse related events. |
Returns
Type | Description |
---|---|
System.Boolean | true if the mouse point reaches the out of visible boundaries; Returns false , if the mouse point inside the visible boundary or the SelectionMode is single or none . |
ChangeFlowDirectionKey(ref Key)
Changes the flow direction of key navigation based on the System.Windows.FlowDirection in SfDataGrid.
Declaration
protected void ChangeFlowDirectionKey(ref Key currentKey)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.Key | currentKey | Contains the key that was pressed. |
CheckIsLastRow(SfDataGrid)
Determines whether the currently navigated row is last row.
Declaration
protected bool CheckIsLastRow(SfDataGrid dataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the navigated row is last row; otherwise, false |
ClearDetailsViewGridSelections(SfDataGrid)
Clears all the selection for the specified DetailsViewDataGrid.
Declaration
protected virtual bool ClearDetailsViewGridSelections(SfDataGrid detailsViewDataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | detailsViewDataGrid | The corresponding DetailsViewDataGrid to clear the selection. |
Returns
Type |
---|
System.Boolean |
ClearRowHeader()
Clears the row header state based on the current row .
Declaration
protected void ClearRowHeader()
Remarks
This method helps to update the visual state of row header based on current row.
ClearSelections(Boolean, Boolean)
Clears the selected cells or rows in SfDataGrid.
Declaration
public abstract void ClearSelections(bool exceptCurrentRow, bool isProgrammatic = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | exceptCurrentRow | Decides whether the current selection can be cleared or not. |
System.Boolean | isProgrammatic | Decides whether to raise events when the selection is cleared pogrammatically. |
CommitAddNew(Boolean)
Commits the new item initialized on the AddNewRow to the underlying data source.
Declaration
protected abstract void CommitAddNew(bool changeState = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | changeState | Indicates whether watermark is enabled on the AddNewRow. |
CreateCurrentCellManager()
Creates the current cell and manages the current cell related operations in SfDataGrid.
Declaration
protected virtual GridCurrentCellManager CreateCurrentCellManager()
Returns
Type | Description |
---|---|
GridCurrentCellManager | Returns the corresponding GridCurrentCellManager instance. |
Dispose()
Releases all resources used by the GridBaseSelectionController class.
Declaration
public void Dispose()
Dispose(Boolean)
Disposes all the resources used by the GridBaseSelectionController class.
Declaration
protected virtual void Dispose(bool isDisposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isDisposing | Indicates whether the call is from Dispose method or from a finalizer. |
GetCurrentDetailsViewGrid(SfDataGrid)
Gets the current DetailsViewDataGrid that contains the current cell.
Declaration
public SfDataGrid GetCurrentDetailsViewGrid(SfDataGrid parentGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | parentGrid | Indicates the corresponding parent grid. |
Returns
Type | Description |
---|---|
SfDataGrid | Returns the corresponding DetailsViewDataGrid that contains the current cell. |
GetGridSelectedRow(Int32)
Gets the selected row information based on the specified row index.
Declaration
public GridRowInfo GetGridSelectedRow(int rowIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The corresponding row index to get selected row information. |
Returns
Type | Description |
---|---|
GridRowInfo | Returns the selected row information. |
HandleCollectionChanged(NotifyCollectionChangedEventArgs, CollectionChangedReason)
Handles the selection when the SelectedItems, Columns and DataSource property collection changes.
Declaration
public abstract 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 | The CollectionChangedReason contains reason for the collection changes. |
Remarks
This method is called when the collection changes on SelectedItems, Columns and DataSource properties in SfDataGrid.
HandleDetailsViewGridKeyDown(KeyEventArgs)
Handles the selection for the keyboard interactions that are performed in DetailsViewDataGrid.
Declaration
public abstract bool HandleDetailsViewGridKeyDown(KeyEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.KeyEventArgs | 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. |
HandleGridOperations(GridOperationsHandlerArgs)
Handles selection when any of the GridOperation such as sorting, filtering, grouping and etc performed in SfDataGrid.
Declaration
public virtual void HandleGridOperations(GridOperationsHandlerArgs args)
Parameters
Type | Name | Description |
---|---|---|
GridOperationsHandlerArgs | args | The GridOperationsHandlerArgs that contains the type of grid operations and its arguments. |
Remarks
This method is called when any of the GridOperation are performed in SfDataGrid.
HandleGroupExpandCollapse(Int32, Int32, Boolean)
Handles the selection when the group is expanded or collapsed in SfDataGrid.
Declaration
public abstract 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. |
Remarks
This method is invoked when the group is expanded or collapsed.
HandleKeyDown(KeyEventArgs)
Handles the selection for the keyboard interactions that are performed in SfDataGrid.
Declaration
public abstract bool HandleKeyDown(KeyEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.KeyEventArgs | 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. |
HandlePointerOperations(GridPointerEventArgs, RowColumnIndex)
Handles selection when any of the PointerOperation such as pressed,released,moved,and etc performed in SfDataGrid.
Declaration
public abstract 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 of the cell. |
Remarks
This method is invoked when any of the PointerOperation are performed in SfDataGrid.
HandleSelectionPropertyChanges(SelectionPropertyChangedHandlerArgs)
Handles selection when the selection property such as SelectedIndex,SelectedItem and SelectionMode value changes occurred.
Declaration
public virtual void HandleSelectionPropertyChanges(SelectionPropertyChangedHandlerArgs handle)
Parameters
Type | Name | Description |
---|---|---|
SelectionPropertyChangedHandlerArgs | handle | The SelectionPropertyChangedHandlerArgs that contains the corresponding property name and its value changes. |
Remarks
This method is invoked when the selection property values such as SelectedIndex,SelectedItem and SelectionMode are changed in SfDataGrid.
MoveCurrentCell(RowColumnIndex, Boolean)
Moves the current cell to the specified rowColumnIndex.
Declaration
public abstract 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 selection is cleared while moving the current cell. |
Remarks
This method is not applicable when the SelectionUnit and NavigationMode is Row.
OnPropertyChanged(String)
Invoked when the property value changes in GridBaseSelectionController class.
Declaration
protected virtual void OnPropertyChanged(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | The property name. |
ProcessCurrentItemChanged(SelectionPropertyChangedHandlerArgs)
Processes the selection when the CurrentItem property value changes.
Declaration
protected virtual void ProcessCurrentItemChanged(SelectionPropertyChangedHandlerArgs handle)
Parameters
Type | Name | Description |
---|---|---|
SelectionPropertyChangedHandlerArgs | handle | The SelectionPropertyChangedHandlerArgs contains the data for the CurrentItem property value changes. |
ProcessDetailsViewCurrentItemChanged()
Processes the selection when the CurrentItem property value changes in DetailsViewDataGrid.
Declaration
protected void ProcessDetailsViewCurrentItemChanged()
Remarks
This method remove the selection from its parent grid when the SelectionMode is Single. For Multiple or Extended , the current cell is reset from parent grid to child grid.
ProcessDragSelection(MouseEventArgs, RowColumnIndex)
Processes the selection when the dragging operation is performed on the SfDataGrid.
Declaration
protected abstract void ProcessDragSelection(MouseEventArgs args, RowColumnIndex rowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseEventArgs | args | Contains data for mouse events. |
RowColumnIndex | rowColumnIndex | The corresponding row and column index to perform drag selection. |
Remarks
This method will be raised when the SelectionMode is Multiple or Extended.
ProcessNavigationModeChanged(SelectionPropertyChangedHandlerArgs)
Processes the selection when the NavigationMode property value changes.
Declaration
protected virtual void ProcessNavigationModeChanged(SelectionPropertyChangedHandlerArgs handle)
Parameters
Type | Name | Description |
---|---|---|
SelectionPropertyChangedHandlerArgs | handle | The SelectionPropertyChangedHandlerArgs contains the data for the NavigationMode property value changes. |
ProcessOnAddNewRow(AddNewRowOperationHandlerArgs)
Processes the selection when new row is initiated or committed and the position of AddNewRow is changed.
Declaration
protected abstract void ProcessOnAddNewRow(AddNewRowOperationHandlerArgs handle)
Parameters
Type | Name | Description |
---|---|---|
AddNewRowOperationHandlerArgs | handle | Contains data for the AddNewRow operation. |
ProcessOnFilterApplied(GridFilteringEventArgs)
Processes the selection when the filtering is applied in SfDataGrid.
Declaration
protected abstract void ProcessOnFilterApplied(GridFilteringEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
GridFilteringEventArgs | args | Contains the data related to filtering operation. |
ProcessOnFilterPopupOpened()
Processes the selection when the filter popup is opened.
Declaration
protected abstract void ProcessOnFilterPopupOpened()
Remarks
This method refreshes the selection while opening the filter popup in SfDataGrid.
ProcessOnFilterRowPositionChanged(DependencyPropertyChangedEventArgs)
Processes the selection when the position of FilterRow is changed.
Declaration
protected abstract void ProcessOnFilterRowPositionChanged(DependencyPropertyChangedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | args | Contains data for the FilterRow position changed. |
ProcessOnGroupChanged(GridGroupingEventArgs)
Processes the selection when the column is grouped in SfDataGrid.
Declaration
protected abstract void ProcessOnGroupChanged(GridGroupingEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
GridGroupingEventArgs | args | Contains the data for collection changes during grouping action. |
Remarks
This method refreshes the selection while grouping the column in SfDataGrid.
ProcessOnPageChanged()
Processes the selection while navigating from one page in to another page in SfDataPager.
Declaration
protected abstract void ProcessOnPageChanged()
ProcessOnPaste(List<Object>)
Processes the selection when the records is pasted on SfDataGrid.
Declaration
protected abstract void ProcessOnPaste(List<object> records)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.Object> | records | Contains the list of records that is pasted in to SfDataGrid. |
ProcessOnRowHeaderChanged()
Processes the selection when the
Declaration
public virtual void ProcessOnRowHeaderChanged()
ProcessOnSortChanged(SortColumnChangedHandle)
Processes the selection when the column is sorted in SfDataGrid.
Declaration
protected abstract void ProcessOnSortChanged(SortColumnChangedHandle sortcolumnHandle)
Parameters
Type | Name | Description |
---|---|---|
SortColumnChangedHandle | sortcolumnHandle | Contains information related to the sorting action. |
Remarks
This method refreshes the selection while sorting the column in SfDataGrid and clear the selection in summary rows.
ProcessOnStackedHeaderRows(StackedHeaderCollectionChangedEventArgs)
Processes the selection when the stacked header collection changes in SfDataGrid.
Declaration
protected abstract void ProcessOnStackedHeaderRows(StackedHeaderCollectionChangedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
StackedHeaderCollectionChangedEventArgs | args | Contains data for stacked header collection changes. |
ProcessSelectedIndexChanged(SelectionPropertyChangedHandlerArgs)
Processes the selection when the SelectedIndex property value changes.
Declaration
protected virtual void ProcessSelectedIndexChanged(SelectionPropertyChangedHandlerArgs handle)
Parameters
Type | Name | Description |
---|---|---|
SelectionPropertyChangedHandlerArgs | handle | The SelectionPropertyChangedHandlerArgs contains the data for the SelectedIndex property value changes. |
ProcessSelectedItemChanged(SelectionPropertyChangedHandlerArgs)
Processes the selection when the SelectedItem property value changes.
Declaration
protected virtual void ProcessSelectedItemChanged(SelectionPropertyChangedHandlerArgs handle)
Parameters
Type | Name | Description |
---|---|---|
SelectionPropertyChangedHandlerArgs | handle | The SelectionPropertyChangedHandlerArgs contains the data for the SelectedItem property value changes. |
ProcessSelectionModeChanged(SelectionPropertyChangedHandlerArgs)
Processes the selection when the SelectionMode property value changes.
Declaration
protected virtual void ProcessSelectionModeChanged(SelectionPropertyChangedHandlerArgs handle)
Parameters
Type | Name | Description |
---|---|---|
SelectionPropertyChangedHandlerArgs | handle | The SelectionPropertyChangedHandlerArgs contains the data for the SelectionMode property changes. |
ProcessTableSummaryChanged(TableSummaryPositionChangedEventArgs)
Processes the selection when the table summary row position is changed.
Declaration
protected abstract void ProcessTableSummaryChanged(TableSummaryPositionChangedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
TableSummaryPositionChangedEventArgs | args | Contains the data for the table summary row position changes. |
ProcessUnBoundRowChanged(UnBoundDataRowCollectionChangedEventArgs)
Processes the selection when the UnBoundRow collection changes.
Declaration
protected abstract void ProcessUnBoundRowChanged(UnBoundDataRowCollectionChangedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
UnBoundDataRowCollectionChangedEventArgs | args | Contains data for the UnBoundRow collection changes. |
RaiseSelectionChanged(List<Object>, List<Object>)
Raises the SelectionChanged event.
Declaration
protected void RaiseSelectionChanged(List<object> addedItems, List<object> removedItems)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.Object> | addedItems | Contains the items that were selected. |
System.Collections.Generic.List<System.Object> | removedItems | Contains the items that were unselected. |
RaiseSelectionChanging(List<Object>, List<Object>)
Raises the SelectionChanging event in SfDataGrid.
Declaration
protected bool RaiseSelectionChanging(List<object> addedItems, List<object> removedItems)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.Object> | addedItems | Contains the items that were selected. |
System.Collections.Generic.List<System.Object> | removedItems | Contains the items that were unselected. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the SelectionChanging is raised; otherwise, false. |
ResumeUpdates()
Resumes usual selection operation in SfDataGrid
Declaration
protected void ResumeUpdates()
ScrollInViewFromBottom(Int32, Key)
Scrolls the specified row index from the bottom to top direction of view in SfDataGrid.
Declaration
protected void ScrollInViewFromBottom(int rowIndex, Key pressedKey)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The corresponding row index to scroll the row. |
System.Windows.Input.Key | pressedKey | The corresponding key that was pressed. |
Remarks
This method helps to scroll the row into view when the row is not present in the view area of SfDataGrid.
ScrollInViewFromTop(Int32, Key)
Scrolls the specified row index from top to bottom direction of view in SfDataGrid.
Declaration
protected void ScrollInViewFromTop(int rowIndex, Key pressedKey)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The corresponding row index to scroll the row |
System.Windows.Input.Key | pressedKey | The corresponding key that was pressed. |
Remarks
This method helps to scroll the row into view when the row is not present in the view area of SfDataGrid.
ScrollToRowIndex(Int32)
Scrolls the specified row index to view in SfDataGrid.
Declaration
protected void ScrollToRowIndex(int rowIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The corresponding row index to scroll the row. |
Remarks
This method helps to scroll the row into view when the row is not present in the view area of SfDataGrid. If the rowIndex is DetailsViewDataRow, the current row index of the particular DetailsViewDataGrid will be scrolled to view.
SelectAll(Boolean)
Selects all the cells in SfDataGrid.
Declaration
public abstract void SelectAll(bool canFocus = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | canFocus | Decides whether the focus can be set to the current cell. |
Remarks
This method only works if the
SelectRows(Int32, Int32)
Selects the rows corresponding to the specified start and end index of the row.
Declaration
public abstract void SelectRows(int startRowIndex, int endRowIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startRowIndex | The start index of the row to select. |
System.Int32 | endRowIndex | The end index of the row to select. |
SetPressedIndex(RowColumnIndex)
Sets the PressedRowColumnIndex of SfDataGird.
Declaration
protected virtual void SetPressedIndex(RowColumnIndex rowcolumnIndex)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | rowcolumnIndex | Indicates the starting position of drag selection. |
Remarks
This method helps to initialize the starting position of drag selection.
SuspendUpdates()
Temporarily suspends the updates for the selection operation in SfDataGrid.
Declaration
protected void SuspendUpdates()
UnWireEvents()
Unwires the events associated with selection operation in SfDataGrid.
Declaration
protected virtual void UnWireEvents()
WireEvents()
Wires the events associated with selection operation in SfDataGrid.
Declaration
protected virtual void WireEvents()
Events
PropertyChanged
Occurs when a property value changes in GridBaseSelectionController class.
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type |
---|
System.ComponentModel.PropertyChangedEventHandler |