Helpers in WinUI DataGrid (SfDataGrid)
13 Apr 20211 minute to read
IndexResolver
SfDataGrid has GridIndexResolver static class present in Syncfusion.UI.Xaml.DataGrid namespace that has some extension methods used to resolve from row or column index to record or visible column index and vice versa
.
Example: You can find the record index from row index using ResolveToRecordIndex method.
Prototype Table
ProtoType | Description |
---|---|
ResolveToRecordIndex(int rowIndex) |
Resolves record index from the RowIndex. When RowIndex does not find any records it returns -1. RecordIndex denotes the index of record in SfDataGrid.View.Records
|
ResolveToRowIndex(int recordIndex) |
Resolves RowIndex from the record index associated with SfDataGrid.View.Records . When record index is lesser than 0 it returns the -1. |
ResolveToRowIndex(object recordItem) |
Resolves row index from the record associated with SfDataGrid.View.Records . When the given record is not available in the collection it returns -1. |
ResolveStartIndexOfGroup(Group group) |
Resolves the start index of group in DataGrid associated with SfDataGrid.View.Groups . When there is no group in DataGrid it returns -1. |
ResolveToTableSummaryIndex(int rowIndex) |
Resolves TableSummaryIndex associated with SfDataGrid.View.Records.TableSummaries . When the row is not a TableSummaryRow, it returns -1. |
ResolveToGridVisibleColumnIndex(int visibleColumnIndex) |
Resolves the GridColumn index from the visible column index. It excludes the RowHeader and IndentColumn . |
ResolveStartIndexBasedOnPosition() |
Resolves the start index based on position. It includes the stacked header also. By default it returns 0. |
ResolveToScrollColumnIndex(int gridColumnIndex) |
Resolves column index from the Grid column index associated with SfDataGrid.Columns . It includes the IndentColumn and RowHeader also. |
ResolveToStartColumnIndex() | Returns start column index of the VisibleColumn. |
GetGridDetailsViewRowIndex(DetailsViewDataGrid detailsViewDataGrid) |
Returns the RowIndex of DetailsViewGrid. You can pass the DetailsViewDataGrid as argument. When the DetailsView is not found it returns the -1. |
GetGridDetailsViewRecord(DetailsViewDataGrid detailsViewDataGrid) |
Returns the DetailsView record. You can pass the DetailsViewDataGrid . When there is no item it returns null value. |
GetTableSummaryCount(TableSummaryRowPosition position) |
Returns the TableSummary count from TableSummaryRowPosition.Position . |
GetHeaderIndex() | Returns the header row index. |
IsInDetailsViewIndex(int rowIndex) |
Decides whether the given row index is DetailsView index or not. |
IsAddNewIndex(int rowIndex) |
Decides whether the given row index is AddNewRow index or not. |
IsTableSummaryIndex(int rowIndex) |
Decides whether the given row index is TableSummary index or not. |
IsHeaderTableSummaryRow(int rowIndex) |
Decides whether the given row index is HeaderTableSummaryRow or not. |
Dispose
The method is associated with relinquishes memory and clears all references associated with SfDataGrid. When you call this method, it releases all the reference for SfDataGrid. So the memory it is occupying using the DataGrid is reclaimed. You have to call SfDataGrid.Dispose method to release the memory.