Class GridHelper
Represents an extension class that provides helper methods for SfDataGrid control.
Inheritance
Namespace: Syncfusion.UI.Xaml.Grid.Helpers
Assembly: Syncfusion.SfGrid.UWP.dll
Syntax
public static class GridHelper : Object
Methods
GetAddNewRowController(SfDataGrid)
Gets the GridAddNewRowController of SfDataGrid.
Declaration
public static GridAddNewRowController GetAddNewRowController(this SfDataGrid dataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The SfDataGrid. |
Returns
Type | Description |
---|---|
GridAddNewRowController |
Examples
var addNewRowController = this.dataGrid.GetAddNewRowController();
GetDetailsViewGrid(SfDataGrid, Int32, String)
Gets the DetailsViewDataGrid for the specified record index and relation column.
Declaration
public static SfDataGrid GetDetailsViewGrid(this SfDataGrid dataGrid, int recordIndex, string relationalColumn)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The SfDataGrid. |
System.Int32 | recordIndex | The record index to get the DetailsViewDataGrid. |
System.String | relationalColumn | The name of relationalColumn to get the DetailsViewDataGrid. |
Returns
Type | Description |
---|---|
SfDataGrid | Returns the DetailsViewDataGrid for the specified record index and relation column. |
Examples
var detailsViewDataGrid = this.dataGrid.GetDetailsViewGrid(0, "ProductDetails");
GetGridModel(SfDataGrid)
Gets the GridModel of SfDataGrid.
Declaration
public static GridModel GetGridModel(this SfDataGrid dataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The SfDataGrid. |
Returns
Type | Description |
---|---|
GridModel | The GridModel. |
Examples
var gridModel = this.dataGrid.GetGridModel();
GetRowGenerator(SfDataGrid)
Gets the RowGenerator of SfDataGrid.
Declaration
public static RowGenerator GetRowGenerator(this SfDataGrid dataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The SfDataGrid. |
Returns
Type | Description |
---|---|
RowGenerator | The RowGenerator. |
Examples
var rowGenerator = this.dataGrid.GetRowGenerator();
GetSourceDataGrid(DetailsViewDataGrid)
Gets the source DataGrid for the specified DetailsViewDataGrid.
Declaration
public static SfDataGrid GetSourceDataGrid(this DetailsViewDataGrid dataGrid)
Parameters
Type | Name | Description |
---|---|---|
DetailsViewDataGrid | dataGrid | The DetailsViewDataGrid to get its source DataGrid. |
Returns
Type | Description |
---|---|
SfDataGrid | The source DataGrid for the specified DetailsViewDataGrid. |
Examples
var detailsViewDataGrid = this.dataGrid.GetDetailsViewGrid(0, "ProductDetails");
var sourceDataGrid = (detailsViewDataGrid as DetailsViewDataGrid).GetSourceDataGrid();
GetValidationHelper(SfDataGrid)
Gets the ValidationHelper of SfDataGrid.
Declaration
public static ValidationHelper GetValidationHelper(this SfDataGrid dataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The SfDataGrid. |
Returns
Type | Description |
---|---|
ValidationHelper | The ValidationHelper. |
Examples
var validationHelper = this.dataGrid.GetValidationHelper();
GetVisualContainer(SfDataGrid)
Gets the VisualContainer of SfDataGrid.
Declaration
public static VisualContainer GetVisualContainer(this SfDataGrid dataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The SfDataGrid. |
Returns
Type | Description |
---|---|
VisualContainer | The VisualContainer. |
Examples
var visualContainer = this.dataGrid.GetVisualContainer();
RefreshColumns(SfDataGrid)
Refreshes the column count, width in SfDataGrid.
Declaration
public static void RefreshColumns(this SfDataGrid dataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The SfDataGrid. |
UpdateDataRow(SfDataGrid, Int32)
Updates the data row for the given row index.
Declaration
public static void UpdateDataRow(this SfDataGrid dataGrid, int rowIndex)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The SfDataGrid. |
System.Int32 | rowIndex | Specifies the row index to update the data row in view. |
Examples
this.dataGrid.UpdateDataRow(1);
UpdateUnboundColumn(SfDataGrid, DataRowBase, String)
Updates the UnboundColumn of the specified DataRowBase and property name in SfDataGrid.
Declaration
public static void UpdateUnboundColumn(this SfDataGrid dataGrid, DataRowBase dataRowBase, string propertyName)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The SfDataGrid. |
DataRowBase | dataRowBase | The corresponding DataRowBase to update the UnboundColumn. |
System.String | propertyName | The corresponding property name to update UnboundColumn in SfDataGrid. |
Examples
var dataRowBase = this.dataGrid.GetRowGenerator().Items.FirstOrDefault(row => row.RowData == this.dataGrid.CurrentItem);
this.dataGrid.UpdateUnboundColumn(dataRowBase, "Discount");
UpdateUnboundColumn(SfDataGrid, Object, String)
Updates GridUnBoundColumn for the specified record and property name.
Declaration
public static void UpdateUnboundColumn(this SfDataGrid dataGrid, object record, string propertyName)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The SfDataGrid. |
System.Object | record | The corresponding record to update unbound column. |
System.String | propertyName | The corresponding property name to update unbound column. |
Examples
this.dataGrid.UpdateUnboundColumn(this.dataGrid.CurrentItem, "Discount");
UpdateUnboundColumns(SfDataGrid, Object)
Updates the unbound columns corresponding to the specified record in SfDataGrid,
Declaration
public static void UpdateUnboundColumns(this SfDataGrid dataGrid, object record)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The SfDataGrid. |
System.Object | record | The corresponding record to update the unbound columns in SfDataGrid. |
Examples
this.dataGrid.UpdateUnboundColumn(this.dataGrid.CurrentItem);