Class SelectionHelper
Represents an extension class that provides the methods for selection in SfDataGrid.
Inheritance
Namespace: Syncfusion.UI.Xaml.Grid.Helpers
Assembly: Syncfusion.SfGrid.UWP.dll
Syntax
public static class SelectionHelper : Object
Methods
AllowFocus(SfDataGrid, RowColumnIndex)
Determines whether the corresponding cell in a column is focusible or not.
Declaration
public static bool AllowFocus(this SfDataGrid DataGrid, RowColumnIndex rowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The SfDataGrid. |
RowColumnIndex | rowColumnIndex | The corresponding rowcolumnindex to check whether the cells in a column is focusible or not. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the cells in a column is focusible; otherwise, false. |
CheckAltKeyPressed()
Determines whether the Alt key is pressed in SfDataGrid.
Declaration
public static bool CheckAltKeyPressed()
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the Alt key is pressed; otherwise, false. |
CheckControlKeyPressed()
Determines whether the control key is pressed in SfDataGrid.
Declaration
public static bool CheckControlKeyPressed()
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the control key is pressed; otherwise, false. |
CheckShiftKeyPressed()
Determines whether the Shift key is pressed in SfDataGrid.
Declaration
public static bool CheckShiftKeyPressed()
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the Shift key is pressed; otherwise, false. |
CheckTabKeyPressed()
Determines whether the Tab key is pressed in SfDataGrid.
Declaration
public static bool CheckTabKeyPressed()
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the Tab key is pressed; otherwise, false. |
GetDataColumnBase(SfDataGrid, RowColumnIndex)
Gets the DataColumnBase for the given RowColumnIndex.
Declaration
public static DataColumnBase GetDataColumnBase(this SfDataGrid DataGrid, RowColumnIndex rowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to get DataColumnBase. |
RowColumnIndex | rowColumnIndex | The corresponding rowcolumnindex to get the DataColumnBase. |
Returns
Type | Description |
---|---|
DataColumnBase | Returns the corresponding DataColumnBase for the specified rowcolumnindex. |
GetDataGrid(SfDataGrid)
Gets the SfDataGrid that has current cell.
Declaration
public static SfDataGrid GetDataGrid(this SfDataGrid dataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The SfDataGrid. |
Returns
Type | Description |
---|---|
SfDataGrid | The SfDataGrid that has current cell. |
GetDetailsViewGrid(SfDataGrid, Int32)
Gets the DetailsViewDataGrid for the specified row index.
Declaration
public static DetailsViewDataGrid GetDetailsViewGrid(this SfDataGrid DataGrid, int rowIndex)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to get the DetailsViewDataGrid. |
System.Int32 | rowIndex | The corresponding rowIndex to get the DetailsViewDataGrid. |
Returns
Type | Description |
---|---|
DetailsViewDataGrid | Returns the DetailsViewDataGrid for the specified row index. The DetailsViewDataGrid return null ,if specified row index doesn't have the DetailsViewDataGrid or it is in collapsed state or the DetailsViewDataGrid is not reused. |
GetFirstColumnIndex(SfDataGrid, FlowDirection)
Gets the index of the first column corresponding to the specified flow direction.
Declaration
public static int GetFirstColumnIndex(this SfDataGrid dataGrid, FlowDirection flowdirection)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The corresponding dataGrid to get the index of first column. |
Windows.UI.Xaml.FlowDirection | flowdirection | Corresponding direction to get the index of first column. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the index of first column. |
GetFirstDataRowIndex(SfDataGrid)
Gets the index of the DataRow positioned at start of the SfDataGrid.
Declaration
public static int GetFirstDataRowIndex(this SfDataGrid DataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to get index of first DataRow. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the index of first DataRow in SfDataGrid.If the record count is zero, return -1. |
GetFirstRowIndex(SfDataGrid)
Gets the index of the row positioned at the start point of SfDataGrid.
Declaration
public static int GetFirstRowIndex(this SfDataGrid DataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to get the first row index. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the first row index in SfDataGrid. If the record count is zero and AddNewRow position is None, return -1. |
GetGridCellInfo(SfDataGrid, RowColumnIndex)
Gets the GridCellInfo for the specified rowcolumnindex.
Declaration
public static GridCellInfo GetGridCellInfo(this SfDataGrid DataGrid, RowColumnIndex rowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The SfDataGrid. |
RowColumnIndex | rowColumnIndex | The corresponding rowcolumnindex to get the cell info. |
Returns
Type | Description |
---|---|
GridCellInfo | Returns GridCellInfo for the specified rowcolumnindex. |
GetLastColumnIndex(SfDataGrid, FlowDirection)
Gets the index of the last column corresponding to the specified flow direction.
Declaration
public static int GetLastColumnIndex(this SfDataGrid dataGrid, FlowDirection flowdirection)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The corresponding dataGrid to get the index of last column. |
Windows.UI.Xaml.FlowDirection | flowdirection | Corresponding direction to get the index of last column. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the index of last column. |
GetLastDataRowIndex(SfDataGrid)
Gets the index of the DataRow positioned at end of the SfDataGrid.
Declaration
public static int GetLastDataRowIndex(this SfDataGrid DataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to get the first row index. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the first row index in SfDataGrid. If the record count is zero or AddNewRow positioned at bottom , return -1. |
GetLastRowIndex(SfDataGrid)
Gets the index of the row positioned at end of the SfDataGrid.
Declaration
public static int GetLastRowIndex(this SfDataGrid DataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to get index of first last. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the index of last row in SfDataGrid. If the record count is zero or AddNewRow positioned at bottom , return -1. |
GetNextPageIndex(SfDataGrid)
Gets the index of the row positioned at the end of next page that is not currently in view of SfDataGrid.
Declaration
public static int GetNextPageIndex(this SfDataGrid DataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid |
Returns
Type | Description |
---|---|
System.Int32 | Returns the end row index of next page. |
GetNextRowInfo(SfDataGrid, Int32)
Gets the next row info at the specified row index in SfDataGrid.
Declaration
public static GridRowInfo GetNextRowInfo(this SfDataGrid DataGrid, int rowIndex)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to get next row info. |
System.Int32 | rowIndex | The corresponding index of row to get next row info |
Returns
Type | Description |
---|---|
GridRowInfo | Returns the next row info of the specified row index. |
GetNodeEntry(SfDataGrid, Int32)
Declaration
public static NodeEntry GetNodeEntry(this SfDataGrid DataGrid, int rowIndex)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | |
System.Int32 | rowIndex |
Returns
Type |
---|
NodeEntry |
GetParentDataGrid(SfDataGrid)
Gets the immediate parent DataGrid of the specified DetailsViewDataGrid.
Declaration
public static SfDataGrid GetParentDataGrid(this SfDataGrid dataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The corresponding DetailsViewDataGrid to get its parent grid. |
Returns
Type | Description |
---|---|
SfDataGrid | Returns the corresponding parent grid . |
GetPreviousPageIndex(SfDataGrid)
Gets the index of the row positioned at the start of the previous page that is not currently in view of SfDataGrid.
Declaration
public static int GetPreviousPageIndex(this SfDataGrid DataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid |
Returns
Type | Description |
---|---|
System.Int32 | The start index of previous page. |
GetPreviousRowInfo(SfDataGrid, Int32)
Gets the previous row info at the specified row index of SfDataGrid.
Declaration
public static GridRowInfo GetPreviousRowInfo(this SfDataGrid DataGrid, int rowIndex)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to get previous row info. |
System.Int32 | rowIndex | The corresponding index of row to get previous row info. |
Returns
Type | Description |
---|---|
GridRowInfo | Returns the previous row info of specified row index. |
GetRecordAtRowIndex(SfDataGrid, Int32)
Gets the record for the specified row index.
Declaration
public static object GetRecordAtRowIndex(this SfDataGrid DataGrid, int index)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to get the record. |
System.Int32 | index | The corresponding row index to get the record. |
Returns
Type | Description |
---|---|
System.Object | The data item corresponding to the specified row index. Return the null , if the specified row index is of AddNewRow . |
GetRecordEntryAtRowIndex(SfDataGrid, Int32)
Gets the record for the specified row index.
Declaration
public static NodeEntry GetRecordEntryAtRowIndex(this SfDataGrid DataGrid, int index)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to get the record. |
System.Int32 | index | The corresponding row index to get the record. |
Returns
Type | Description |
---|---|
NodeEntry | The data item corresponding to the specified row index. Return null , if the row index is of AddNewRow . |
GetRecordsCount(SfDataGrid, Boolean)
Gets the number of records in SfDataGrid.
Declaration
public static int GetRecordsCount(this SfDataGrid DataGrid, bool checkUnBoundRows = true)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding dataGrid to get the records count. |
System.Boolean | checkUnBoundRows | Indicates whether UnBoundRows count is considered to get the records count. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the number of records in SfDataGrid. |
GetSelectedDetailsViewGridRowIndex(SfDataGrid)
Gets the index of currently selected Details View row .
Declaration
public static int GetSelectedDetailsViewGridRowIndex(this SfDataGrid DataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to get index of selected Details View row. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the index of selected Details View row. If the selection is not found at Details View, return -1. |
GetTopLevelParentDataGrid(SfDataGrid)
Gets the top level parent grid.
Declaration
public static SfDataGrid GetTopLevelParentDataGrid(this SfDataGrid DataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to get the top level parent grid. |
Returns
Type | Description |
---|---|
SfDataGrid | Returns the top level parent grid. |
HideRowFocusBorder(SfDataGrid)
Hides the row focus border for the specified row index.
Declaration
public static void HideRowFocusBorder(this SfDataGrid DataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to hide the row focus border. |
HideRowSelection(SfDataGrid, Int32)
Hides the selection background for the specified row index.
Declaration
public static void HideRowSelection(this SfDataGrid DataGrid, int rowIndex)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to hide the selection background. |
System.Int32 | rowIndex | The corresponding row index to hide the selection background. |
ShowRowFocusBorder(SfDataGrid, Int32)
Shows the row focus border for the specified row index.
Declaration
public static void ShowRowFocusBorder(this SfDataGrid DataGrid, int rowIndex)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to enable the row focus border. |
System.Int32 | rowIndex | The corresponding row index to enable row focus border. |
ShowRowSelection(SfDataGrid, Int32)
Shows the selection background for the specified row index.
Declaration
public static void ShowRowSelection(this SfDataGrid DataGrid, int rowIndex)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to enable the selection background. |
System.Int32 | rowIndex | The corresponding row index to enable the selection background. |
Remarks
The selection background applied based on the RowSelectionBrush property.
UpdateRowHeaderState(SfDataGrid)
Updates the visual state of the RowHeader based on the current cell or row changed.
Declaration
public static void UpdateRowHeaderState(this SfDataGrid DataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | DataGrid | The corresponding DataGrid to update the visual state of RowHeader. |