Class SfDataGrid
A data bound list control that displays the items from data source in a tabular view. The SfDataGrid control allows you to select, sort and group these items.
Inheritance
Implements
Namespace: Syncfusion.SfDataGrid
Assembly: Syncfusion.SfDataGrid.Android.dll
Syntax
public class SfDataGrid : FrameLayout, IDisposable
Remarks
The SfDataGrid control provides a flexible way to display a collection of data in rows and columns. The SfDataGrid includes built-in column types and a template column for hosting custom content.
To bind the SfDataGrid to data, set the ItemsSource property to an IEnumerable implementation. Each row in the data grid is bound to an object in the data source, and each column in the data grid is bound to a property of the data object. In order for the SfDataGrid user interface to update automatically when items are added to or removed from the source data, the SfDataGrid must be bound to a collection that implements the System.Collections.Specialized.INotifyCollectionChanged interface, such as an System.Collections.ObjectModel.ObservableCollection<>. To automatically reflect property changes, the objects in the source collection must implement the System.ComponentModel.INotifyPropertyChanged interface.
Constructors
SfDataGrid(Context)
Initializes the new instance of SfDataGrid class.
Declaration
public SfDataGrid(Context context)
Parameters
Type | Name | Description |
---|---|---|
Android.Content.Context | context | The context of SfDataGrid. |
SfDataGrid(Context, IAttributeSet)
Initializes a new instance of the SfDataGrid class.
Declaration
public SfDataGrid(Context context, IAttributeSet attributeSet)
Parameters
Type | Name | Description |
---|---|---|
Android.Content.Context | context | The Android.Content.Context. |
Android.Util.IAttributeSet | attributeSet | The Android.Util.IAttributeSet. |
SfDataGrid(Context, IAttributeSet, Int32)
Initializes a new instance of the SfDataGrid class.
Declaration
public SfDataGrid(Context context, IAttributeSet attributeSet, int definedStyle)
Parameters
Type | Name | Description |
---|---|---|
Android.Content.Context | context | The Android.Content.Context. |
Android.Util.IAttributeSet | attributeSet | The Android.Util.IAttributeSet. |
System.Int32 | definedStyle | The value indicating the defined style. |
SfDataGrid(Context, IAttributeSet, Int32, Int32)
Initializes a new instance of the SfDataGrid class.
Declaration
public SfDataGrid(Context context, IAttributeSet attribute, int defaultStyleAttribute, int defaultStyleResource)
Parameters
Type | Name | Description |
---|---|---|
Android.Content.Context | context | The Android.Content.Context. |
Android.Util.IAttributeSet | attribute | The Android.Util.IAttributeSet. |
System.Int32 | defaultStyleAttribute | The default style |
System.Int32 | defaultStyleResource | The default resource |
SfDataGrid(IntPtr, JniHandleOwnership)
Initializes a new instance of the SfDataGrid class.
Declaration
protected SfDataGrid(IntPtr javaReference, JniHandleOwnership transfer)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | javaReference | The System.IntPtr. |
Android.Runtime.JniHandleOwnership | transfer | The Android.Runtime.JniHandleOwnership. |
Properties
AllowDraggingColumn
Gets or sets a value indicating whether to enable/disable the column dragging functionality in a SfDataGrid control. SfDataGrid allows you to drag and drop a column header by enabling this property.
Declaration
public bool AllowDraggingColumn { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if column dragging is enabled, otherwise false. The default value is false. |
Remarks
SfDataGrid allows you to drag and drop a column header by setting the AllowDraggingColumn property to true. Drag view is displayed while dragging a column header. The drag and drop operation can be handled based on the requirement using QueryColumnDragging event.
Examples
dataGrid.AllowDraggingColumn = true;
See Also
AllowDraggingRow
Gets or sets a value indicating whether to enable/disable the row dragging functionality in a SfDataGrid control. SfDataGrid also allows you to customize the row drag and drop popup using the RowDragDropTemplate property.
Declaration
public bool AllowDraggingRow { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if row dragging is enabled, otherwise false. The default value is false. |
Remarks
SfDataGrid allows you to drag and drop a row by setting the AllowDraggingRow property to true. A customizable row drag and drop view is displayed while dragging a row. The drag and drop operation can be handled based on the requirement using QueryRowDragging event.
Examples
dataGrid.AllowDraggingRow = true;
See Also
AllowEditing
Gets or sets a value indicating whether to enable/disable editing in runtime. SfDataGrid provides support for editing the cell values, when AllowEditing is set as true.
Declaration
public bool AllowEditing { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if editing is enabled, otherwise false. The default value is false. |
Examples
dataGrid.AllowEditing = true;
See Also
AllowGroupExpandCollapse
Gets or sets a value indicating whether to allow expanding and collapsing of groups in SfDataGrid. By default, the groups will be in expanded state in SfDataGrid, when grouped. However, the user can expand or collapse a group in runtime by enabling this property.
Declaration
public bool AllowGroupExpandCollapse { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if expand and collapse groups is enabled, otherwise false. The default value is false. |
Examples
this.dataGrid.AllowGroupExpandCollapse = true;
See Also
AllowLoadMore
Gets or sets a value indicating whether to enable/disable the load more option for adding more records in runtime, when the grid is scrolled to the last record of the collection. On enabling this property, SfDataGrid provides an option to add more items to the underlying collection when the LoadMoreView is tapped, by executing the LoadMoreCommand and hence it is mandatory to set the property too for enabling the load more option.
Declaration
public bool AllowLoadMore { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True, if load more is enabled, otherwise false. The default value is false. |
Remarks
SfDataGrid provides an option to load more items in runtime, when the grid is scrolled to the last record of the collection. A command will be fired when the LoadMoreView is tapped and it can be used to add more items to the underlying data. To enable the load more feature, you must set the AllowLoadMore to true and also must set the LoadMoreCommand property. By default, a button will be displayed when the grid is scrolled to the last record. However, SfDataGrid allows you to customize this view based on the requirement using LoadMoreView property.
Examples
dataGrid.AllowLoadMore = true;
dataGrid.LoadMoreCommand = new Command(ExecuteLoadMoreCommand);
private async void ExecuteLoadMoreCommand()
{
this.dataGrid.IsBusy = true;
await Task.Delay(new TimeSpan(0, 0, 5));
viewModel.LoadMoreItems();
this.dataGrid.IsBusy = false;
}
See Also
AllowMultiSorting
Gets or sets a value indicating whether to enable multi sorting or not. By enabling the multi sorting, SfDataGrid allows the user to sort the data against more than one columns.
Declaration
public bool AllowMultiSorting { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if multi sorting is enabled, otherwise false. The default value is false. |
Remarks
SfDataGrid allows multiple sorting by which the underlying data can be sorted by more than one columns. To apply sorting for multiple columns, tap the desired column headers after setting the AllowMultiSorting property to true.
Examples
dataGrid.AllowMultiSorting = true;
See Also
AllowPullToRefresh
Gets or sets a value indicating whether to enable/disable the refreshing option upon pulling the grid. On enabling this property, SfDataGrid provides an option to refresh it when performing the pulling action. The refreshing can be done using the PullToRefreshCommand and hence it is mandatory to set the property too for enabling the refreshing option.
Declaration
public bool AllowPullToRefresh { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if pull to refresh is enabled, otherwise False. By default, value is false. |
Remarks
SfDataGrid provides an option to refresh it when performing the pulling action. A command will be fired and it can be used to refresh (add, delete or modify the underlying data) the grid. To enable the pull to refresh feature, you must set the AllowPullToRefresh to true and also must set the PullToRefreshCommand property. By default, a busy indicator will be displayed when doing the pulling animation. However, SfDataGrid allows you to customize this view based on the requirement using PullToRefreshView property.
Examples
dataGrid.AllowPullToRefresh = true;
dataGrid.PullToRefreshCommand = new Command(ExecutePullToRefreshCommand);
private async void ExecutePullToRefreshCommand()
{
this.dataGrid.IsBusy = true;
await Task.Delay(new TimeSpan(0, 0, 5));
viewModel.ItemsSourceRefresh ();
this.dataGrid.IsBusy = false;
}
//Command.cs
public class Command : ICommand
{
}
See Also
AllowResizingColumn
Gets or sets a value indicating whether to enable the column resizing or not. SfDataGrid allows to resize the columns by tapping and dragging the right border of the column headers, by enabling this property.
Declaration
public bool AllowResizingColumn { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if column resizing is enabled, otherwise false. The default value is false. |
Remarks
By enabling column resizing in SfDataGrid by setting AllowResizingColumn to true, the columns can be resized from MinimumWidth to MaximumWidth.
Examples
dataGrid.AllowResizingColumn = true;
See Also
AllowSorting
Gets or sets a value indicating whether to enable/disable sorting in SfDataGrid. When AllowSorting is set as true, the user can sort the data simply by tapping the column header he wishes to sort. SfDataGrid also allows the user to programmatically sort the column by adding the SortColumnDescription to the SortColumnDescriptions collection.
Declaration
public bool AllowSorting { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if sorting is enabled, otherwise false. The default value is false. |
Remarks
SfDataGrid allows to sort the data by setting the AllowSorting as true. The user can sort the data by just tapping the column header he wishes to sort or programmatically sort the column by adding the SortColumnDescription to the SortColumnDescriptions collection. Once sorting is applied, the SfDataGrid shows a sort icon in the respective column header indicating the direction of sorting.
Examples
dataGrid.AllowSorting = true;
See Also
AllowSwiping
Gets or sets a boolean value denoting whether to enable/disable the swiping in SfDataGrid control. Swipe views are displayed when swiping from ‘left to right’ or ‘right to left’ on a data row when swiping is enabled.
Declaration
public bool AllowSwiping { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True, if swiping is enabled, otherwise false. The default value is false. |
Remarks
When swiping is enabled in SfDataGrid, the swipe view can be displayed when swiping from ‘left to right’ or ‘right to left’ on a data row. SfDataGrid allows the user to customize the swipe views to be displayed by using LeftSwipeView and RightSwipeView. The swipe gesture can be restricted up to a certain point by using MaxSwipeOffset property.
Examples
dataGrid.AllowSwiping = true;
See Also
AllowTriStateSorting
Gets or sets a value indicating whether to enable tri-state sorting or not. By enabling the tri-state sorting in the SfDataGrid, the data can be sorted in three states : ascending, descending and unsorted.
Declaration
public bool AllowTriStateSorting { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if tri-state sorting is enabled, otherwise false. The default value is false. |
Remarks
SfDataGrid also allows you to unsort the data in the original order by clicking the header again after sorting to descending order by setting the AllowTriStateSorting property to true.
Examples
dataGrid.AllowTriStateSorting = true;
See Also
AlternatingRowColor
Gets or sets the color of the alternating row of SfDataGrid.
Declaration
public Color AlternatingRowColor { get; set; }
Property Value
Type | Description |
---|---|
Android.Graphics.Color | The color of the alternating row. |
AlternationCount
Gets or sets the alternation count for applying alternate row color to the rows of SfDataGrid.
Declaration
public int AlternationCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The alternation count of the rows for which the alternate row color should be applied. |
Remarks
SfDataGrid allows the user to set alternate row color by setting the AlternatingRowColor property to GridStyle. property. SfDataGrid allows you to customize the rows for which the alternate row color needs to be updated based on the AlternationCount property.
Examples
dataGrid.GridStyle.AlternatingRowColor = Color.Fuschia;
dataGrid.AlternationCount = 3;
See Also
AutoExpandGroups
Gets or sets a value indicating whether the SfDataGrid should auto expand groups when grouping. By enabling, this property, when the user group any column, then all groups will be in expanded state.
Declaration
public bool AutoExpandGroups { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if auto expand groups is enabled, otherwise, false. The default value is true. |
Examples
this.dataGrid.AutoExpandGroups = true;
See Also
AutoGenerateColumns
Gets or sets a boolean value indicating whether to generate the columns automatically or not. The SfDataGrid creates columns automatically based on the property AutoGenerateColumns. It decides columns generation for SfDataGrid based on the AutoGenerateColumnsMode property.
Declaration
public bool AutoGenerateColumns { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if auto generate columns is enabled, otherwise false. The default value is true. |
Remarks
The SfDataGrid creates columns automatically based on the property AutoGenerateColumns. It decides columns generation for SfDataGrid based on the AutoGenerateColumnsMode property. The user can also customize the automatically generated column by using the AutoGeneratingColumn event.
Examples
dataGrid.AutoGenerateColumns = true;
See Also
AutoGenerateColumnsMode
Gets or sets the AutoGenerateColumnsMode of SfDataGrid control. To generate the columns automatically based on the underlying collection the user must set the AutoGenerateColumns as true. SfDataGrid decides columns generation based on the AutoGenerateColumnsMode property.
Declaration
public AutoGenerateColumnsMode AutoGenerateColumnsMode { get; set; }
Property Value
Type | Description |
---|---|
AutoGenerateColumnsMode | The AutoGenerateColumnsMode of SfDataGrid. The default value is Reset. |
Remarks
When columns are generated automatically by setting SfDataGrid.AutoGenerateColumns = true
, the user can set the
mode in which the columns should be generated by using the AutoGenerateColumnsMode property.
The user can also customize the automatically generated column by using the AutoGeneratingColumn event.
In order to include only the columns defined manually in the Columns collection, the user must set the
AutoGenerateColumnsMode as None.
Examples
dataGrid.AutoGenerateColumnsMode = AutoGenerateColumnsMode.None;
See Also
CanUseViewFilter
Gets or sets a value that indicates whether to create view by considering the DataView.RowFilter.
Declaration
public bool CanUseViewFilter { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if View should filter the rows in SfDataGrid, using DataView.RowFilter expression; otherwise ,false. The default value is false. |
Examples
this.dataGrid.CanUseViewFilter = true;
CaptionSummaryRow
Gets or sets the caption summary row of the group in the SfDataGrid. Every group as a caption summary row,
which is used to display the summary information in the caption of the group.
Declaration
public GridSummaryRow CaptionSummaryRow { get; set; }
Property Value
Type | Description |
---|---|
GridSummaryRow | The caption summary row of the group in the SfDataGrid. |
Remarks
SfDataGrid provides built-in support for caption summaries. The caption summary value calculated based on the records in a group and the summary information will be displayed in the caption of group.
See Also
CellBorderStyle
Gets or sets the cell border style.
Declaration
public CellBorderStyle CellBorderStyle { get; set; }
Property Value
Type | Description |
---|---|
CellBorderStyle | The cell border style of SfDataGrid. |
CellRenderers
Gets the GridCellRendererCollection that contains the cell renderers in SfDataGrid. The CellRenderers manages the creation of cells view objects when the cell is scrolled into view and also unloading of the views. Contains logics to place the UIElement inside cells in display and edit mode.
Declaration
public GridCellRendererCollection CellRenderers { get; }
Property Value
Type | Description |
---|---|
GridCellRendererCollection | The collection containing the renderers in the SfDataGrid. |
Remarks
The CellRenderers manages the creation of cells view objects when the cell is scrolled into view and also unloading of the views. Contains logics to place the UIElement inside cells in display and edit mode. The user can implement the renderer by extending it from the renderer he needs and customize the type of cell to be loaded for each column type in editing and normal mode.
Note:When the user overrides the renderer, he needs to replace it in the CellRenderers collection. For example, if the user implements the GridCellTextViewRenderer class, to customize the cell in the GridTextColumn, then he needs to replace it in the CellRenderers collection.
Examples
dataGrid.CellRenderers.Remove("TextView");
dataGrid.CellRenderers.Add("TextView", CustomTextViewRenderer);
//CustomTextViewRenderer.cs
public class CustomTextViewRenderer : GridCellTextViewRenderer
{
}
Columns
Gets or sets the Columns collection of the SfDataGrid. The Columns collection contains the columns in the SfDataGrid which are created for each property in the model class. The user can add the various column types to the SfDataGrid based on the requirement by specifying the MappingName which associates the property in the data source.
Declaration
public Columns Columns { get; set; }
Property Value
Type | Description |
---|---|
Columns | The columns collection of the SfDataGrid. |
Remarks
The Columns collection contains the columns in the SfDataGrid which are created for each property in the model class. SfDataGrid allows you to define the columns manually by adding the GridColumn objects to the Columns collection. There are different types of columns available in SfDataGrid and you can create any column based on your requirement.
Examples
dataGrid.Columns.Add(new GridTextColumn() { MappingName = "OrderID" });
See Also
ColumnSizer
Gets or sets the ColumnSizer of the SfDataGrid, that specify how columns in the SfDataGrid are sized. SfDataGrid applies width for all the GridColumn in the Columns collection. based on the ColumnSizer property.
Declaration
public ColumnSizer ColumnSizer { get; set; }
Property Value
Type | Description |
---|---|
ColumnSizer | The type of ColumnSizer that is applied to the SfDataGrid. The default value is None. |
Remarks
The user can specify how columns in the SfDataGrid are sized. SfDataGrid applies width for all the GridColumn in the Columns collection based on the ColumnSizer property. When the ColumnSizer is Star, all the GridColumn are adjusted an equal column width to fit within the view.
Examples
dataGrid.ColumnSizer = ColumnSizer.Star;
See Also
CurrentCellManager
Declaration
public GridCurrentCellManager CurrentCellManager { get; set; }
Property Value
Type |
---|
GridCurrentCellManager |
CurrentItem
Gets or sets the current selected item of the SfDataGrid.
Declaration
public object CurrentItem { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The current selected item of the SfDataGrid. |
DataFetchSize
Gets or sets the data fetch size for the Incremental Source. SfDataGrid supports incremental loading, the user can customize the size of data to be fetched in incremental loading by using DataFetchSize property.
Declaration
public int DataFetchSize { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The size of the data to be fetched for the incremental source. The default value is 5. |
Remarks
SfDataGrid supports Incremental loading, by which when the user reaches the end of the collection in the dataGrid, the data will be fetched automatically. The user can customize the size of the data to be fetched by setting the DataFetchSize property.
Examples
dataGrid.DataFetchSize = 10;
DefaultColumnWidth
Gets or sets the default column width of the SfDataGrid. GridColumn renders in view based on the value of DefaultColumnWidth property in SfDataGrid.
Declaration
public double DefaultColumnWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default column width of the SfDataGrid. The default value is 120. |
Remarks
SfDataGrid allows you to customize the default column width property based on the requirement by setting the DefaultColumnWidth property. Columns are arranged in view based on the DefaultColumnWidth property when the ColumnSizer is None.
Examples
dataGrid.DefaultColumnWidth = 100;
EditorSelectionBehavior
Gets or sets the editor selection behavior, when a grid cell enters into edit mode. The editor selection behavior indicates the position of cursor and selection in edit element, when entering into edit mode. SfDataGrid provides support for editing the cell values, when AllowEditing is set as true.
Declaration
public EditorSelectionBehavior EditorSelectionBehavior { get; set; }
Property Value
Type | Description |
---|---|
EditorSelectionBehavior | The EditorSelectionBehavior, when SfDataGrid enters into editing mode. The default value is MoveLast. |
Remarks
SfDataGrid provides support for customizing the editor selection behavior when the cell enters into edit mode. SfDataGrid either selects the text of edit element loaded inside cell or places the cursor at the last of edit element loaded inside cell. By default, SfDataGrid places the cursor at the last of the edit element.
Examples
dataGrid.EditorSelectionBehavior = EditorSelectionBehavior.SelectAll;
See Also
EditTapAction
Gets or sets the edit TapAction to enter edit mode in SfDataGrid. SfDataGrid provides support for editing the cell values, when AllowEditing is set as true.
Declaration
public TapAction EditTapAction { get; set; }
Property Value
Type | Description |
---|---|
TapAction | The tap action selected for entering into editing mode. The default value is OnDoubleTap. |
Remarks
The user can customize the edit tap action by setting the EditTapAction property. SfDataGrid enters into edit mode either by just tapping or double tapping the grid cells.
Examples
this.dataGrid.EditTapAction = TapAction.OnTap;
See Also
EnableDataVirtualization
Gets or sets a value that indicates whether to create RecordEntry for all the objects in SourceCollection while loading itself. By default RecordEntry created for all the objects of SourceCollection.
Declaration
public bool EnableDataVirtualization { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True to create RecordEntry only when try to access this index. |
Remarks
If the SourceCollection is null then GetItemAt(Int32) used to populates the Records.
Examples
dataGrid.EnableDataVirtualization = true;
Engine
Gets or sets the GridEngine of the SfDataGrid, which notifies the renderering of cells inside the SfDataGrid
Declaration
public GridEngine Engine { get; set; }
Property Value
Type | Description |
---|---|
GridEngine | The GridEngine of SfDataGrid.
|
FrozenColumnsCount
Gets or sets the frozen columns count to freeze the columns at the left, next to the row header column if ShowRowHeader is true.
Declaration
public int FrozenColumnsCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of columns to be frozen from left end, next to row header, if ShowRowHeader is true. The default value is 0. |
Remarks
SfDataGrid also provides support to freeze the columns at the left of the view by setting the FrozenColumnsCount property.
Examples
dataGrid.FrozenColumnsCount = 2;
See Also
FrozenRowsCount
Gets or sets the frozen rows count to freeze the rows at the top below header.
Declaration
public int FrozenRowsCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of rows to be frozen from top below header. The default value is 0. |
Remarks
SfDataGrid provides extensive support to freeze the rows at the top of the view below the header row by setting the FrozenRowsCount property.
Examples
dataGrid.FrozenRowsCount = 2;
See Also
GridColumnSizer
Gets or sets the GridColumnSizer of the SfDataGrid, which handles the column sizing for all the columns in the Columns collection of SfDataGrid.
Declaration
public GridColumnSizer GridColumnSizer { get; set; }
Property Value
Type | Description |
---|---|
GridColumnSizer | The GridColumnSizer of SfDataGrid. |
GridModel
Gets or Sets the GridModel of the SfDataGrid.
Declaration
protected GridModel GridModel { get; set; }
Property Value
Type |
---|
GridModel |
GridStyle
Gets or sets the grid style of the SfDataGrid. The default style will be applied to the SfDataGrid, the user can customize the style applied to the SfDataGrid.
Declaration
public DataGridStyle GridStyle { get; set; }
Property Value
Type | Description |
---|---|
DataGridStyle | The grid style of the SfDataGrid. |
Remarks
SfDataGrid allows to customize the style of datagrid, by implementing the DataGridStyle class and setting the customized grid style class as GridStyle.
Examples
dataGrid.GridStyle = new CustomGridStyle();
//CustomGridStyle.cs
public class CustomGridStyle : DataGridStyle
{
}
See Also
GroupCaptionTextFormat
Gets or sets the group caption text format of the caption summary rows in SfDataGrid.
Declaration
public string GroupCaptionTextFormat { get; set; }
Property Value
Type | Description |
---|---|
System.String | The group caption text format of the caption summary rows in SfDataGrid. |
See Also
GroupColumnDescriptions
Gets or sets the group column descriptions of the SfDataGrid.
Declaration
public GroupColumnDescriptions GroupColumnDescriptions { get; set; }
Property Value
Type | Description |
---|---|
GroupColumnDescriptions | The GroupColumnDescriptions collection of SfDataGrid. |
Remarks
SfDataGrid allows grouping by which the underlying data is grouped based on the column added in the group column descriptions collection.
Examples
dataGrid.GroupColumnDescriptions.Add (new GroupColumnDescription () {
ColumnName = "CustomerID",
});
See Also
GroupingMode
Gets or sets the grouping mode which specifies whether only single column or multiple columns can be grouped.
Declaration
public GroupingMode GroupingMode { get; set; }
Property Value
Type | Description |
---|---|
GroupingMode | The grouping mode. |
GroupSummaryRows
Gets or sets the collection of group summary rows of the SfDataGrid. The group summary value is calculated based on all the records in SfDataGrid. SfDataGrid allows you to add multiple group summary rows at bottom of each group.
Declaration
public ObservableCollection<GridGroupSummaryRow> GroupSummaryRows { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ObservableCollection<GridGroupSummaryRow> | The collection of GridGroupSummaryRow of SfDataGrid. |
Remarks
SfDataGrid provides built-in support for group summaries. Group Summary is used to display the summary information at bottom of each group in SfDataGrid. The user can add group summary row in SfDataGrid by adding GridGroupSummaryRow to the GroupSummaryRows collection.
Examples
GridGroupSummaryRow summaryRow = new GridGroupSummaryRow();
summaryRow.SummaryColumns.Add(new GridSummaryColumn()
{
Name = "TotalSalary",
MappingName = "Salary",
Format = "{Sum}",
SummaryType = SummaryType.DoubleAggregate
});
sfGrid.GroupSummaryRows.Add(summaryRow);
HeaderRowHeight
Gets or sets the row height of the header in SfDataGrid.
Declaration
public double HeaderRowHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The height of the header row. The default value is 50. |
Remarks
SfDataGrid allows you to customize the height of the header row by setting the HeaderRowHeight property. The user can collapse the header row by setting HeaderRowHeight to zero.
Examples
dataGrid.HeaderRowHeight = 40;
See Also
IndentColumnWidth
Gets or sets the width of the indent column which is created for representing the grouping levels when the GroupingMode is Multiple.
Declaration
public double IndentColumnWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The width of the indent column. The default value is 20. |
Remarks
SfDataGrid allows you to customize the width of the indent column based on the requirement by setting the IndentColumnWidth.
Examples
dataGrid.IndentColumnWidth = 20;
IsBusy
Gets or sets a value indicating the busy state of the SfDataGrid when executing the LoadMoreCommand or PullToRefreshCommand.
Declaration
public bool IsBusy { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if SfDataGrid is executing either the LoadMoreCommand or PullToRefreshCommand, otherwise false. By default the value is false. |
Remarks
SfDataGrid will be busy when the underlying collection is refreshed or modified by executing the LoadMoreCommand or PullToRefreshCommand.
ItemsSource
Gets or set the external data source of SfDataGrid, to display the data in the grid. It supports the data sources such as System.Collections.Generic.List<>, System.Collections.ObjectModel.ObservableCollection<>, and so on. ItemsSource property helps to bind the SfDataGrid with the collection of objects.
Declaration
public object ItemsSource { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The items source of the SfDataGrid. |
Remarks
To bind the SfDataGrid to data, set the ItemsSource property to an System.Collections.IEnumerable implementation. Each row in the data grid is bound to an object in the data source, and each column in the data grid is bound to a property of the data object. In order for the SfDataGrid user interface to update automatically when items are added to or removed from the source data, the SfDataGrid must be bound to a collection that implements the System.Collections.Specialized.INotifyCollectionChanged interface, such as an System.Collections.ObjectModel.ObservableCollection<>. To automatically reflect property changes, the objects in the source collection must implement the System.ComponentModel.INotifyPropertyChanged interface.
Examples
dataGrid.ItemsSource = viewModel.OrderInfoCollection;
See Also
LeftSwipeView
Gets or sets the left swipe view to be displayed when swiping from 'left to right'. SfDataGrid enables you to load a desired content to be displayed when swiping towards right using this property. The swipe views will be displayed only when AllowSwiping is set as true.
Declaration
public SwipeView LeftSwipeView { get; set; }
Property Value
Type | Description |
---|---|
Syncfusion.SfDataGrid.SwipeView | The view that is displayed when left swipe action is performed. |
Remarks
When swiping is enabled in SfDataGrid, the swipe view can be displayed when swiping from ‘left to right’ or ‘right to left’ on a data row. SfDataGrid allows the user to customize the swipe views to be displayed by using LeftSwipeView and RightSwipeView. The swipe gesture can be restricted upto a certain point by using MaxSwipeOffset property. The contents inside the swipe view are arranged based on the offset values when you swipe a data row.
Examples
SwipeView leftSwipeView = new SwipeView(BaseContext);
sfGrid.LeftSwipeView = leftSwipeView;
See Also
LiveDataUpdateMode
Gets or sets a value to control data manipulation operations during data updates.
Declaration
public LiveDataUpdateMode LiveDataUpdateMode { get; set; }
Property Value
Type | Description |
---|---|
LiveDataUpdateMode | Indicates how data manipulation operations are handled during data updates. The default value is Default. |
LoadMoreCommand
Gets or sets the command to be executed when an end-user taps the LoadMoreView to load new data items in SfDataGrid.
Declaration
public ICommand LoadMoreCommand { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Input.ICommand | The command to be executed when load more view is clicked. |
Remarks
SfDataGrid allows to load more items in the datagrid, when the last data of the collection is reached, by executing the LoadMoreCommand when an end-user taps the LoadMoreView of SfDataGrid.
Examples
dataGrid.AllowLoadMore = true;
dataGrid.LoadMoreCommand = new Command(ExecuteLoadMoreCommand);
private async void ExecuteLoadMoreCommand()
{
this.dataGrid.IsBusy = true;
await Task.Delay(new TimeSpan(0, 0, 5));
viewModel.LoadMoreItems();
this.dataGrid.IsBusy = false;
}
See Also
LoadMorePosition
Gets or sets the position to load the LoadMoreView in SfDataGrid control. When the grid is scrolled to the last record of the collection, a view will be displayed which provides an option to load more items when the LoadMoreView is tapped. The user can customize the position of the LoadMoreView either to appear in the bottom or top below the header using this property. To enable the load more option, it is mandatory to set AllowLoadMore as true.
Declaration
public LoadMoreViewPosition LoadMorePosition { get; set; }
Property Value
Type | Description |
---|---|
LoadMoreViewPosition | The LoadMoreViewPosition to display the LoadMoreView in SfDataGrid. The default value is Bottom. |
Remarks
SfDataGrid allows the user to customize the position of the LoadMoreView. By default, the load more view will be positioned at the bottom of SfDataGrid. The user can customize the load more view to appear in the top below the header by setting LoadMorePosition as Top.
Examples
dataGrid.LoadMorePosition = LoadMoreViewPosition.Top;
See Also
LoadMoreText
Gets or sets the load more text to be displayed in the LoadMoreView. By default, the LoadMoreView displays the "LOAD MORE ITEMS" text, the user can customize the text to be displayed in the LoadMoreView by using this property.
Declaration
public string LoadMoreText { get; set; }
Property Value
Type | Description |
---|---|
System.String | The text to be displayed in LoadMoreView. By default, the value is "LOAD MORE ITEMS". |
Examples
dataGrid.LoadMoreText = "Load More Items";
See Also
LoadMoreView
Gets or sets the LoadMoreView of the SfDataGrid, which will be displayed when the grid is scrolled to the last position of SfDataGrid, provided that AllowLoadMore is set as true.
Declaration
public LoadMoreView LoadMoreView { get; set; }
Property Value
Type | Description |
---|---|
LoadMoreView | The LoadMoreView of SfDataGrid. |
Remarks
SfDataGrid provides an option to load more items in runtime, when the grid is scrolled to the last record of the collection. A command will be fired when the LoadMoreView is tapped and it can be used to add more items to the underlying data. To enable the load more feature, you must set the AllowLoadMore to true and also must set the LoadMoreCommand property.
By default, load more view is a button, containing the text "LOAD MORE ITEMS". SfDataGrid allows to customize the load more view, by implementing the LoadMoreView class and setting the customized load more view class to LoadMoreView.
Examples
dataGrid.LoadMoreView = new CustomLoadMoreView();
//CustomLoadMoreView.cs
public class CustomLoadMoreView : LoadMoreView
{
}
See Also
MaxSwipeOffset
Gets or sets the maximum swipe offset of SfDataGrid control. SfDataGrid enables the swiping option by setting the AllowSwiping to true. Swipe views are displayed when swiping from ‘left to right’ or ‘right to left’ on a data row. The swipe gesture can be restricted up to a certain point by using this property.
Declaration
public int MaxSwipeOffset { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The maximum swipe offset of SfDataGrid. The default value is 200. |
Examples
dataGrid.MaximumSwipeOffset = 300;
See Also
NavigationMode
Declaration
public NavigationMode NavigationMode { get; set; }
Property Value
Type |
---|
NavigationMode |
NotificationSubscriptionMode
Gets or sets the NotificationSubscriptionMode of SfDataGrid. By default, SfDataGrid gets the notification for collection and property change of the underlying data. The user can customize the datagrid to get notifications from underlying data for either collection change or property change or both or none of them by using this property.
Declaration
public NotificationSubscriptionMode NotificationSubscriptionMode { get; set; }
Property Value
Type | Description |
---|---|
NotificationSubscriptionMode | The NotificationSubscriptionMode of SfDataGrid. The default value is CollectionChange and PropertyChange. |
Examples
dataGrid.NotificationSubscriptionMode = NotificationSubscriptionMode.PropertyChange;
PullToRefreshCommand
Gets or sets the command to be executed when performing the pulling operation to refresh the grid. You must set this property to an System.Windows.Input.ICommand and the property to true to enable pulling operation in SfDataGrid. This command will be fired upon performing the pulling operation for doing the refreshing operation.
Declaration
public ICommand PullToRefreshCommand { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Input.ICommand | The command to be executed when PullToRefresh action is performed. |
Remarks
SfDataGrid provides an option to refresh it when performing the pulling action. PullToRefreshCommand will be fired to refresh (add, delete or modify the underlying data) the grid. A busy indicator will be displayed to denote the pulling and refreshing operation.
Examples
dataGrid.AllowPullToRefresh = true;
dataGrid.PullToRefreshCommand = new Command(ExecutePullToRefreshCommand);
private async void ExecutePullToRefreshCommand()
{
this.dataGrid.IsBusy = true;
await Task.Delay(new TimeSpan(0, 0, 5));
viewModel.ItemsSourceRefresh ();
this.dataGrid.IsBusy = false;
}
//Command.cs
public class Command : ICommand
{
}
See Also
PullToRefreshView
Gets or sets the view to indicate the Progress of pulling operation in a SfDataGrid. Any view that can indicate the Progress of the pulling can be assigned to the property such that it animates the values of the Progress of pulling.
Declaration
public PullToRefreshView PullToRefreshView { get; set; }
Property Value
Type | Description |
---|---|
PullToRefreshView | The view that is displayed when pull to refresh is done. |
Remarks
SfDataGrid provides you an option to refresh it when performing the pulling action. A command will be fired when pulling action is performed and it can be used to refresh (add, delete or modify the underlying data) in the grid. To enable the pull to refresh feature, you must set the AllowPullToRefresh to true and also must set the command to PullToRefreshCommand property. By default, a busy indicator will be displayed when doing the pulling action. However, SfDataGrid allows you to customize this view based on the requirement using PullToRefreshView property.
Examples
dataGrid.PullToRefreshView = new CustomPullToRefreshView();
// CustomPullToRefreshView.cs
public class CustomPullToRefreshView : PullToRefreshView
{
}
ResizingMode
Gets or sets a value indicating the ResizingMode for the resizing operation in a SfDataGrid control. Columns in SfDataGrid can be resized either on touch-up or on-move.
Declaration
public ResizingMode ResizingMode { get; set; }
Property Value
Type | Description |
---|---|
ResizingMode | The ResizingMode of SfDataGrid. The default value is OnMoved. |
Remarks
SfDataGrid allows two modes of resizing, which can be set using this property. The available resizing modes are: OnMoved and OnTouchUp.
Examples
dataGrid.ResizingMode = ResizingMode.OnTouchUp;
See Also
RightSwipeView
Gets or sets the left swipe view to be displayed when swiping from 'right to left'. SfDataGrid enables you to load a desired content to be displayed when swiping towards left using this property. The swipe views will be displayed only when AllowSwiping is set as true.
Declaration
public SwipeView RightSwipeView { get; set; }
Property Value
Type | Description |
---|---|
Syncfusion.SfDataGrid.SwipeView | The view that is displayed when right swipe action is performed. |
Remarks
When swiping is enabled in SfDataGrid, the swipe view can be displayed when swiping from ‘left to right’ or ‘right to left’ on a data row. SfDataGrid allows the user to customize the swipe views to be displayed by using LeftSwipeTemplate and RightSwipeTemplate. The swipe gesture can be restricted upto a certain point by using MaxSwipeOffset property. The contents inside the swipe view are arranged based on the offset values when you swipe a data row.
Examples
SwipeView rightSwipeView = new SwipeView(BaseContext);
sfGrid.RightSwipeView = rightSwipeView;
See Also
RowDragDropTemplate
Gets or sets the view to be displayed when row drag and drop action is performed. SfDataGrid allows the user to load a desired content when performing row drag and drop operation using this property. To enable row drag and drop, it is mandatory to set AllowDraggingRow to true.
Declaration
public View RowDragDropTemplate { get; set; }
Property Value
Type | Description |
---|---|
Android.Views.View | The view that is displayed when row drag and drop action is done. |
Remarks
SfDataGrid allows you to drag and drop a row by setting the AllowDraggingRow property to true. A customizable row drag and drop view is displayed while dragging a row. The default view will be displayed, if row drag and drop view is empty. The drag and drop operation can be handled based on the requirement using QueryRowDragging event.
Examples
dataGrid.RowDragDropTemplate = new RowTemplate();
//RowTemplate.cs
public class RowTemplate : LinearLayout
{
}
See Also
RowGenerator
Gets or Sets the RowGenerator.
Declaration
protected RowGenerator RowGenerator { get; set; }
Property Value
Type |
---|
RowGenerator |
RowHeaderWidth
Gets or sets the width of the row header column which will be frozen at the left end of the view. To include the row header column, the user needs to set ShowRowHeader as true.
Declaration
public double RowHeaderWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The width of the row header column. The default value is 20. |
Remarks
SfDataGrid allows you to customize the width of the row header column based on the requirement by setting the RowHeaderWidth.
Examples
dataGrid.ShowRowHeader = true;
dataGrid.RowHeaderWidth = 15;
RowHeight
Gets or sets the height of the rows in the body and footer region of SfDataGrid.
Declaration
public double RowHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The height of the rows in the body and footer region of SfDataGrid. The default value is 40. |
Remarks
SfDataGrid allows you to customize the height of the grid rows in the body and footer region by setting the RowHeight property. This property responds to runtime changes and hence you can customize it based on your requirement.
Examples
dataGrid.RowHeight = 50;
See Also
ScrollingMode
Gets or sets the ScrollingMode of the SfDataGrid. By default, SfDataGrid scrolls based on the pixel values. The user can customize the scrolling mode of the SfDataGrid by using the ScrollingMode property.
Declaration
public ScrollingMode ScrollingMode { get; set; }
Property Value
Type | Description |
---|---|
ScrollingMode | The ScrollingMode of the SfDataGrid. The default value is Pixel. |
Remarks
SfDataGrid allows to customize the scrolling mode of SfDataGrid using the ScrollingMode property. SfDataGrid provides three types of scrolling mode : Line, PixelLine and Pixel.
Examples
dataGrid.ScrollingMode = ScrollingMode.PixelLine;
See Also
SelectedIndex
Gets or sets the selected row's index in the SfDataGrid. To enable Selection in SfDataGrid, you need to set the SelectionMode property to value other than None.
Declaration
public int SelectedIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The index of the selected row in the SfDataGrid. |
Remarks
SfDataGrid lets you to select a specific row either programmatically or by touch interactions. Selection can also be done programmatically by setting the row index to be selected to the SelectedIndex property.
Examples
dataGrid.SelectedIndex = 3;
See Also
SelectedItem
Gets or sets the selected item of the SfDataGrid. To enable Selection in SfDataGrid, you need to set the SelectionMode property to value other than None.
Declaration
public object SelectedItem { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The selected item of the SfDataGrid. |
Remarks
SfDataGrid lets you to select a specific row either programmatically or by touch interactions. Selection can also be done programmatically by setting the underlying object to be selected to the SelectedItem property.
Examples
dataGrid.SelectedItem = viewModel.OrdersInfo[5];
See Also
SelectedItems
Gets the selected items collection of the SfDataGrid. To enable multiple Selection in SfDataGrid, you need to set the SelectionMode property to Multiple.
Declaration
public ObservableCollection<object> SelectedItems { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ObservableCollection<System.Object> | The selected items collection of the SfDataGrid. |
Remarks
SfDataGrid lets you to select a specific row or group of rows either programmatically or by touch interactions. When the selection mode is Multiple the user can programmatically select more than one row by adding the underlying object to be selected to the SelectedItems property.
Examples
dataGrid.SelectedItems.Add (viewModel.OrdersInfo [4]);
dataGrid.SelectedItems.Add (viewModel.OrdersInfo [5]);
See Also
SelectionController
Gets or sets the GridSelectionController of the SfDataGrid. The GridSelectionController handles the selection operations of SfDataGrid.
Declaration
public GridSelectionController SelectionController { get; set; }
Property Value
Type | Description |
---|---|
GridSelectionController | The selection controller of the SfDataGrid. |
Remarks
The GridSelectionController contains methods that handle selection feature of SfDataGrid. The user can customize the GridSelectionController by implementing the GridSelectionController class and by setting the customized selection controller class to the SelectionController. SfDataGrid provides extensibility to have multiple selection colors and to animate the selected rows by extending the GridSelectionController class.
Examples
sfGrid.SelectionController = new CustomSelectionController(sfGrid);
//CustomSelectionController.cs
public class CustomSelectionController : GridSelectionController
{
}
See Also
SelectionMode
Gets or sets the SelectionMode of the SfDataGrid. To enable Selection in SfDataGrid, you need to set the SelectionMode property to value other than None.
Declaration
public SelectionMode SelectionMode { get; set; }
Property Value
Type | Description |
---|---|
SelectionMode | The SelectionMode of the SfDataGrid. The default value is None. |
Remarks
SfDataGrid lets you to select a specific row or group of rows either programmatically or by touch interactions. SfDataGrid allows to control the selection mode by using the SelectionMode property. SfDataGrid supports different selection modes : Single, Multiple, NoneNone and SingleDeselect.
Examples
dataGrid.SelectionMode = SelectionMode.Single;
See Also
ShowColumnWhenGrouped
Gets or sets a value indicating whether the grouped column should be rendered in view or not.
Declaration
public bool ShowColumnWhenGrouped { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the column is displayed in SfDataGrid ; otherwise ,false.The default value is true. |
ShowRowHeader
Gets or sets a boolean value indicating whether to include the row header or not. By default, nothing will be displayed in the row header.
Declaration
public bool ShowRowHeader { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if row header is visible, otherwise false. The default value is false. |
Remarks
To include the RowHeader column to SfDataGrid, you need to set the ShowRowHeader to true.
Initially when you set the SfDataGrid.ShowRowHeader = true
, you will be able to see empty cells in front of the rows.
To customize the RowHeaderCell the user needs to implement the GridRowHeaderCellRenderer class and replace it in
the CellRenderers collection.
Examples
dataGrid.ShowRowHeader = true;
See Also
SortColumnDescriptions
Gets or sets the collection of SortColumnDescription of SfDataGrid. The user can get the columns that represent sorting from the SortColumnDescriptions collection. SfDataGrid also allows the user to programmatically sort the column by adding the SortColumnDescription to the SortColumnDescriptions collection. The user must set the AllowSorting as true for enabling interactive sorting in a SfDataGrid.
Declaration
public SortColumnDescriptions SortColumnDescriptions { get; set; }
Property Value
Type | Description |
---|---|
SortColumnDescriptions | The collection of columns which represent sorting. |
Remarks
The user can get the columns that represent sorting from the SortColumnDescriptions collection. SfDataGrid also allows the user to programmatically sort the column by adding the SortColumnDescription to the SortColumnDescriptions collection. The user must specify the column to be sorted in the ColumnName which represents the MappingName of the column and the user can optionally set the direction of sorting to be applied by setting the SortDirection. By default columns will be sorted in the ascending order.
Examples
dataGrid.AllowSorting = true;
dataGrid.SortColumnDescriptions.Add (new SortColumnDescription()
{
ColumnName = "OrderID",
SortDirection = ListSortDirection.Descending
});
See Also
SortComparers
Gets or sets the SortComparers of SfDataGrid, for applying sorting to the columns based on the custom logic. SfDataGrid allows you to sort columns based on custom logic when the standard sorting techniques do not meet the requirements. For each column, you can apply different sorting criteria by adding SortComparer objects to SortComparers collection.
Declaration
public SortComparers SortComparers { get; }
Property Value
Type | Description |
---|---|
SortComparers | The SortComparers of SfDataGrid. |
Remarks
SfDataGrid allows you to sort columns based on custom logic when the standard sorting techniques do not meet the requirements. For each column, you can apply different sorting criteria by adding SortComparer objects to SortComparers collection. The SortComparer has the two properties : PropertyName which refers to MappingName of the column to apply sorting. and Comparer which refers to the custom sort comparer that implements the System.Collections.IComparer and ISortDirection interfaces.
Examples
dataGrid.SortComparers.Add (new SortComparer ()
{
PropertyName = "FirstName",
Comparer = new CustomComparer()
});
dataGrid.SortColumnDescriptions.Add (new SortColumnDescription()
{
ColumnName = "FirstName",
SortDirection = ListSortDirection.Descending
});
//CustomComparer.cs
public class CustomComparer : IComparer<Object>, ISortDirection
{
}
SortTapAction
Gets or sets a value indicating whether to sort the data on single tap or double tap action.
Declaration
public SortTapAction SortTapAction { get; set; }
Property Value
Type | Description |
---|---|
SortTapAction | The value indicating the sort tap action. The default value is SingleTap. |
Remarks
SfDataGrid allows to customize the SortTapAction by which the user can apply sorting either in single tap or double tap action.
Examples
dataGrid.SortTapAction = SortTapAction.DoubleTap;
See Also
SourceType
Gets or sets the SourceType of the ItemsSource.
Declaration
public Type SourceType { get; set; }
Property Value
Type | Description |
---|---|
System.Type | The type of the data source of SfDataGrid. |
Remarks
The user can specify the type of ItemsSource in the SourceType property. The user may get the System.InvalidCastException sometimes when binding with complex data collections which can easily be handled by simply specifying the type of ItemsSource in the SourceType as given in the code example.
Examples
dataGrid.SourceType = typeof(OrderInfo);
Exceptions
Type | Condition |
---|---|
System.InvalidCastException | Sometimes you may get this exception, if you get this exception, you need to set this property as given in the code example. |
SummaryCalculationMode
Gets or sets a value that denotes the mode of calculation for caption and group summaries for improved performance.
Declaration
public CalculationMode SummaryCalculationMode { get; set; }
Property Value
Type | Description |
---|---|
CalculationMode | One of the CalculationMode that indicates when to perform the summary calculation. The default value isDefault. |
TableSummaryRows
Gets or sets the collection of table summary rows of the SfDataGrid. The table summary value is calculated based on all the records in SfDataGrid. SfDataGrid allows you to add multiple table summary rows either at top or bottom or at both positions.
Declaration
public ObservableCollection<GridTableSummaryRow> TableSummaryRows { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ObservableCollection<GridTableSummaryRow> | The collection of GridTableSummaryRow of SfDataGrid. |
Remarks
SfDataGrid provides built-in support for table summaries. Table Summary is used to display the summary information at top and/or bottom in SfDataGrid. The user can add table summary row in SfDataGrid by adding GridTableSummaryRow to the TableSummaryRows collection.
Examples
GridTableSummaryRow summaryRow = new GridTableSummaryRow();
summaryRow.SummaryColumns.Add(new GridSummaryColumn()
{
Name = "TotalSalary",
MappingName = "Salary",
Format = "{Sum}",
SummaryType = SummaryType.DoubleAggregate
});
sfGrid.TableSummaryRows.Add(summaryRow);
UnboundRowCellRenderers
Gets the reference to the GridCellRendererCollection instance which holds the renderer's for UnboundRow Cell.
Declaration
public GridCellRendererCollection UnboundRowCellRenderers { get; }
Property Value
Type |
---|
GridCellRendererCollection |
UnboundRows
Gets or sets the collection of UnboundRows of the SfDataGrid.
Declaration
public UnboundRows UnboundRows { get; set; }
Property Value
Type |
---|
UnboundRows |
VerticalOverScrollMode
Gets or sets a value indicating what effect to be applied when SfDataGrid is vertically over scrolled. SfDataGrid enables either to provide a bounce effect or no effect when SfDataGrid is vertically over-scrolled.
Declaration
public VerticalOverScrollMode VerticalOverScrollMode { get; set; }
Property Value
Type | Description |
---|---|
VerticalOverScrollMode | The VerticalOverScrollMode of SfDataGrid. By default, Bounce effect is applied. |
Examples
dataGrid.VerticalOverScrollMode = VerticalOverScrollMode.None;
See Also
View
Gets the current view of the SfDataGrid. SfDataGrid has the View property of type ICollectionViewAdv interface that implements Syncfusion.Data.ICollectionView interface. View is responsible for maintaining and manipulating data and other advanced operations like Sorting, Grouping, and etc.
Declaration
public ICollectionViewAdv View { get; }
Property Value
Type | Description |
---|---|
ICollectionViewAdv | The collection view of the SfDataGrid. |
Remarks
SfDataGrid has the View property of type ICollectionViewAdv interface that implements Syncfusion.Data.ICollectionView interface. When you bind collection to ItemsSource property, the View will be created and maintains the operations on data such as grouping, sorting, insert, delete, and modification.
See Also
Methods
add_AutoGeneratingColumn(AutoGeneratingColumnEventHandler)
Declaration
public void add_AutoGeneratingColumn(AutoGeneratingColumnEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
AutoGeneratingColumnEventHandler | value |
add_ColumnResizing(GridResizingEventHandler)
Declaration
public void add_ColumnResizing(GridResizingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridResizingEventHandler | value |
add_CurrentCellBeginEdit(GridCurrentCellBeginEditEventHandler)
Declaration
public void add_CurrentCellBeginEdit(GridCurrentCellBeginEditEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridCurrentCellBeginEditEventHandler | value |
add_CurrentCellEndEdit(GridCurrentCellEndEditEventHandler)
Declaration
public void add_CurrentCellEndEdit(GridCurrentCellEndEditEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridCurrentCellEndEditEventHandler | value |
add_GridDoubleTapped(GridDoubleTappedEventHandler)
Declaration
public void add_GridDoubleTapped(GridDoubleTappedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridDoubleTappedEventHandler | value |
add_GridLoaded(GridLoadedEventHandler)
Declaration
public void add_GridLoaded(GridLoadedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridLoadedEventHandler | value |
add_GridLongPressed(GridLongPressedEventHandler)
Declaration
public void add_GridLongPressed(GridLongPressedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridLongPressedEventHandler | value |
add_GridTapped(GridTappedEventHandler)
Declaration
public void add_GridTapped(GridTappedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridTappedEventHandler | value |
add_GridViewCreated(GridViewCreatedEventHandler)
Declaration
public void add_GridViewCreated(GridViewCreatedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridViewCreatedEventHandler | value |
add_GroupCollapsed(GroupChangedEventHandler)
Declaration
public void add_GroupCollapsed(GroupChangedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GroupChangedEventHandler | value |
add_GroupCollapsing(GroupChangingEventHandler)
Declaration
public void add_GroupCollapsing(GroupChangingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GroupChangingEventHandler | value |
add_GroupExpanded(GroupChangedEventHandler)
Declaration
public void add_GroupExpanded(GroupChangedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GroupChangedEventHandler | value |
add_GroupExpanding(GroupChangingEventHandler)
Declaration
public void add_GroupExpanding(GroupChangingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GroupChangingEventHandler | value |
add_OnScrolled(GridScrolledEventHandler)
Declaration
public void add_OnScrolled(GridScrolledEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridScrolledEventHandler | value |
add_QueryColumnDragging(QueryColumnDraggingEventHandler)
Declaration
public void add_QueryColumnDragging(QueryColumnDraggingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
QueryColumnDraggingEventHandler | value |
add_QueryRowDragging(QueryRowDraggingEventHandler)
Declaration
public void add_QueryRowDragging(QueryRowDraggingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
QueryRowDraggingEventHandler | value |
add_QueryRowHeight(QueryRowHeightEventHandler)
Declaration
public void add_QueryRowHeight(QueryRowHeightEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
QueryRowHeightEventHandler | value |
add_QueryUnboundColumnValue(QueryUnboundColumnValueHandler)
Declaration
public void add_QueryUnboundColumnValue(QueryUnboundColumnValueHandler value)
Parameters
Type | Name | Description |
---|---|---|
QueryUnboundColumnValueHandler | value |
add_SelectionChanged(GridSelectionChangedEventHandler)
Declaration
public void add_SelectionChanged(GridSelectionChangedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridSelectionChangedEventHandler | value |
add_SelectionChanging(GridSelectionChangingEventHandler)
Declaration
public void add_SelectionChanging(GridSelectionChangingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridSelectionChangingEventHandler | value |
add_SortColumnsChanged(DataGridSortColumnsChangedEventHandler)
Declaration
public void add_SortColumnsChanged(DataGridSortColumnsChangedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
DataGridSortColumnsChangedEventHandler | value |
add_SortColumnsChanging(DataGridSortColumnsChangingEventHandler)
Declaration
public void add_SortColumnsChanging(DataGridSortColumnsChangingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
DataGridSortColumnsChangingEventHandler | value |
add_SwipeEnded(SwipeEndedEventHandler)
Declaration
public void add_SwipeEnded(SwipeEndedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
SwipeEndedEventHandler | value |
add_SwipeStarted(SwipeStartedEventHandler)
Declaration
public void add_SwipeStarted(SwipeStartedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
SwipeStartedEventHandler | value |
add_Swiping(SwipingEventHandler)
Declaration
public void add_Swiping(SwipingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
SwipingEventHandler | value |
BeginEdit(Int32, Int32)
Begins editing of the grid cell in the specified row and column index.
Declaration
public void BeginEdit(int rowIndex, int columnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index in which editing should be done. |
System.Int32 | columnIndex | The column index in which editing should be done. |
Remarks
The user can edit the required cell programmatically by using this method, specifying the row and column index of the cell to be edited.
See Also
CancelEdit()
Cancels the editing of the grid cell which is currently being edited.
Declaration
public void CancelEdit()
Remarks
The user can cancel the editing in the current cell programmatically by using this method. Edited values will not be committed to the GridCell.
See Also
CollapseAllGroup()
Collapses all the groups in SfDataGrid.
Declaration
public void CollapseAllGroup()
Remarks
This method collapses all the groups in SfDataGrid programmatically.
See Also
CollapseGroup(Group)
Collapses the specified Group.
Declaration
public void CollapseGroup(Group group)
Parameters
Type | Name | Description |
---|---|---|
Group | group | Specifies the group to collapse it from view. |
Examples
var group = (dataGrid.View.Groups[0] as Group);
this.dataGrid.CollapseGroup(group);
See Also
CollapseGroupsAtLevel(Int32)
Collapses the group based on its level.
Declaration
public void CollapseGroupsAtLevel(int groupLevel)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | groupLevel | Specifies the group level to collapse the group. |
Examples
this.dataGrid.CollapseGroupsAtLevel(2);
CreateCollectionView(Object)
Creates a collection view for the given source object.
Declaration
protected virtual void CreateCollectionView(object source)
Parameters
Type | Name | Description |
---|---|---|
System.Object | source | An object to set as ItemsSource for dataGrid. |
CreateCollectionViewAdv(IEnumerable)
Creates the ICollectionViewAdv wrapper for the given source object.
Declaration
protected virtual ICollectionViewAdv CreateCollectionViewAdv(IEnumerable source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | source | The System.Collections.IEnumerable object is set as ItemsSource for dataGrid. |
Returns
Type | Description |
---|---|
ICollectionViewAdv | Returns a collection view wrapper for the given source object. |
Dispose(Boolean)
Releases the unmanaged resources used by the component and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | if true - release both managed and unmanaged resources; if false - release only unmanaged resources. |
EndEdit()
Ends the editing of the grid cell which is currently being edited.
Declaration
public void EndEdit()
Remarks
The user can end editing in the current cell programmatically by using this method. Edited values will be committed to the GridCell.
See Also
ExpandAllGroup()
Expands all the groups in SfDataGrid.
Declaration
public void ExpandAllGroup()
Remarks
This method expands all the groups in SfDataGrid programmatically.
See Also
ExpandGroup(Group)
Expands the specified group.
Declaration
public void ExpandGroup(Group group)
Parameters
Type | Name | Description |
---|---|---|
Group | group | Specifies the group to expand it from view. |
Examples
var group = (dataGrid.View.Groups[0] as Group);
this.dataGrid.ExpandGroup(group);
See Also
ExpandGroupsAtLevel(Int32)
Expands the group based on its level.
Declaration
public void ExpandGroupsAtLevel(int groupLevel)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | groupLevel | Specifies the group level to expand the group. |
Examples
this.dataGrid.ExpandGroupsAtLevel(2);
GetUnboundCellValue(GridColumn, Object)
Gets the cell value to populate the unbound column by evaluating the expression or format with the record.
Declaration
public object GetUnboundCellValue(GridColumn column, object record)
Parameters
Type | Name | Description |
---|---|---|
GridColumn | column | Specifies the corresponding column to get the cell value. |
System.Object | record | Specifies the corresponding record to get the cell value. |
Returns
Type | Description |
---|---|
System.Object | Returns the cell value of the specified column based on expression or format with record. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the GridUnboundColumn is defined with Expression for DataTable . |
InvalidateRowHeight(Int32)
Invalidates the height of the specified row to raise in the QueryRowHeight event programmatically.
Declaration
public void InvalidateRowHeight(int rowIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | Specifies the corresponding row index to invalidate its row height. |
Remarks
Resets the particular row height. Once row heights are reset, need to call the InvalidateMeasureInfo method of Syncfusion.SfDataGrid.SfDataGrid.VisualContainer to refresh the view.
Examples
dataGrid.InvalidateRowHeight(2);
InvalidateRowHeight(Int32, Boolean)
Invalidates the height of the specified row to raise in the QueryRowHeight event programmatically.
Declaration
public void InvalidateRowHeight(int rowIndex, bool canInvalidate = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | Specifies the corresponding row index to invalidate its row height. |
System.Boolean | canInvalidate | Specifies whether to invalidate the row or not. |
Remarks
Resets the particular row height. Once row heights are reset, need to call the InvalidateMeasureInfo method of Syncfusion.SfDataGrid.SfDataGrid.VisualContainer to refresh the view.
Examples
dataGrid.InvalidateRowHeight(2, true);
InvalidateUnboundRow(GridUnboundRow, Boolean)
Invalidates the unbound row to refresh the data in View.
Declaration
public void InvalidateUnboundRow(GridUnboundRow unBoundRow, bool canInvalidateColumn = true)
Parameters
Type | Name | Description |
---|---|---|
GridUnboundRow | unBoundRow | Specifies the GridUnboundRow to be invalidated. |
System.Boolean | canInvalidateColumn | Specifies to whether to in invalidate columns or not. |
OnAttachedToWindow()
When view is attched to window.
Declaration
protected override void OnAttachedToWindow()
OnDetachedFromWindow()
This is called when the view is detached from a window.
Declaration
protected override void OnDetachedFromWindow()
Remarks
This is called when the view is detached from a window. At this point it no longer has a surface for drawing.
OnLayout(Boolean, Int32, Int32, Int32, Int32)
Layout the children in the view. Derived classes with children should override this method and call layout on each of their children.
Declaration
protected override void OnLayout(bool changed, int left, int top, int right, int bottom)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | changed | True if the size of the view is changed, otherwise false. |
System.Int32 | left | Left position, relative to parent |
System.Int32 | top | Top position, relative to parent |
System.Int32 | right | Right position, relative to parent |
System.Int32 | bottom | Bottom position, relative to parent |
OnMeasure(Int32, Int32)
Raises the measure event.
Declaration
protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | widthMeasureSpec | Width measure spec. |
System.Int32 | heightMeasureSpec | Height measure spec. |
RaiseQueryRowHeight(QueryRowHeightEventArgs)
Raises the height of the query row.
Declaration
protected bool RaiseQueryRowHeight(QueryRowHeightEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
QueryRowHeightEventArgs | e | E. |
Returns
Type | Description |
---|---|
System.Boolean |
|
RaiseQueryUnboundRow(GridUnboundRowEventArgs)
Raises the
Declaration
protected GridUnboundRowEventArgs RaiseQueryUnboundRow(GridUnboundRowEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
GridUnboundRowEventArgs | args | Specifies the |
Returns
Type |
---|
GridUnboundRowEventArgs |
Refresh()
Refresh the view in runtime.
Declaration
public void Refresh()
RefreshContainerAndView()
The VisualContainer and the SfDataGrid's view is refreshed for the first time after the items source is set. The HeaderLineCount, row and column count is updated in this method.
Declaration
protected virtual void RefreshContainerAndView()
RefreshHeaderLineCount()
The SfDataGrid's HeaderLineCount is set.
Declaration
protected virtual void RefreshHeaderLineCount()
remove_AutoGeneratingColumn(AutoGeneratingColumnEventHandler)
Declaration
public void remove_AutoGeneratingColumn(AutoGeneratingColumnEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
AutoGeneratingColumnEventHandler | value |
remove_ColumnResizing(GridResizingEventHandler)
Declaration
public void remove_ColumnResizing(GridResizingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridResizingEventHandler | value |
remove_CurrentCellBeginEdit(GridCurrentCellBeginEditEventHandler)
Declaration
public void remove_CurrentCellBeginEdit(GridCurrentCellBeginEditEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridCurrentCellBeginEditEventHandler | value |
remove_CurrentCellEndEdit(GridCurrentCellEndEditEventHandler)
Declaration
public void remove_CurrentCellEndEdit(GridCurrentCellEndEditEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridCurrentCellEndEditEventHandler | value |
remove_GridDoubleTapped(GridDoubleTappedEventHandler)
Declaration
public void remove_GridDoubleTapped(GridDoubleTappedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridDoubleTappedEventHandler | value |
remove_GridLoaded(GridLoadedEventHandler)
Declaration
public void remove_GridLoaded(GridLoadedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridLoadedEventHandler | value |
remove_GridLongPressed(GridLongPressedEventHandler)
Declaration
public void remove_GridLongPressed(GridLongPressedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridLongPressedEventHandler | value |
remove_GridTapped(GridTappedEventHandler)
Declaration
public void remove_GridTapped(GridTappedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridTappedEventHandler | value |
remove_GridViewCreated(GridViewCreatedEventHandler)
Declaration
public void remove_GridViewCreated(GridViewCreatedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridViewCreatedEventHandler | value |
remove_GroupCollapsed(GroupChangedEventHandler)
Declaration
public void remove_GroupCollapsed(GroupChangedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GroupChangedEventHandler | value |
remove_GroupCollapsing(GroupChangingEventHandler)
Declaration
public void remove_GroupCollapsing(GroupChangingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GroupChangingEventHandler | value |
remove_GroupExpanded(GroupChangedEventHandler)
Declaration
public void remove_GroupExpanded(GroupChangedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GroupChangedEventHandler | value |
remove_GroupExpanding(GroupChangingEventHandler)
Declaration
public void remove_GroupExpanding(GroupChangingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GroupChangingEventHandler | value |
remove_OnScrolled(GridScrolledEventHandler)
Declaration
public void remove_OnScrolled(GridScrolledEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridScrolledEventHandler | value |
remove_QueryColumnDragging(QueryColumnDraggingEventHandler)
Declaration
public void remove_QueryColumnDragging(QueryColumnDraggingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
QueryColumnDraggingEventHandler | value |
remove_QueryRowDragging(QueryRowDraggingEventHandler)
Declaration
public void remove_QueryRowDragging(QueryRowDraggingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
QueryRowDraggingEventHandler | value |
remove_QueryRowHeight(QueryRowHeightEventHandler)
Declaration
public void remove_QueryRowHeight(QueryRowHeightEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
QueryRowHeightEventHandler | value |
remove_QueryUnboundColumnValue(QueryUnboundColumnValueHandler)
Declaration
public void remove_QueryUnboundColumnValue(QueryUnboundColumnValueHandler value)
Parameters
Type | Name | Description |
---|---|---|
QueryUnboundColumnValueHandler | value |
remove_SelectionChanged(GridSelectionChangedEventHandler)
Declaration
public void remove_SelectionChanged(GridSelectionChangedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridSelectionChangedEventHandler | value |
remove_SelectionChanging(GridSelectionChangingEventHandler)
Declaration
public void remove_SelectionChanging(GridSelectionChangingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
GridSelectionChangingEventHandler | value |
remove_SortColumnsChanged(DataGridSortColumnsChangedEventHandler)
Declaration
public void remove_SortColumnsChanged(DataGridSortColumnsChangedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
DataGridSortColumnsChangedEventHandler | value |
remove_SortColumnsChanging(DataGridSortColumnsChangingEventHandler)
Declaration
public void remove_SortColumnsChanging(DataGridSortColumnsChangingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
DataGridSortColumnsChangingEventHandler | value |
remove_SwipeEnded(SwipeEndedEventHandler)
Declaration
public void remove_SwipeEnded(SwipeEndedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
SwipeEndedEventHandler | value |
remove_SwipeStarted(SwipeStartedEventHandler)
Declaration
public void remove_SwipeStarted(SwipeStartedEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
SwipeStartedEventHandler | value |
remove_Swiping(SwipingEventHandler)
Declaration
public void remove_Swiping(SwipingEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
SwipingEventHandler | value |
ResetSwipeOffset()
Reset the swipe offset of SfDataGrid. This method will reset the swiping offset programmatically when we no need to maintain the swiping after navigating to another page.
Declaration
public void ResetSwipeOffset()
ResetUnboundRowIndex()
Resets the row index of UnboundRow and its maintained for internal purpose.
Declaration
protected void ResetUnboundRowIndex()
ScrollToColumnIndex(Int32, ScrollToPosition)
Scrolls the SfDataGrid to the column at the given index. SfDataGrid scrolls to the given column index, next to the RowHeader column if the ShowRowHeader is true.
Declaration
public void ScrollToColumnIndex(int columnIndex, ScrollToPosition scrollToColumnPosition)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | columnIndex | The destination column index to scroll. |
ScrollToPosition | scrollToColumnPosition | Determines the position of the scrolled column in the datagrid. The default value is Start. |
Remarks
SfDataGrid supports programmatic scrolling. The user can scroll to the required column by using this method.
See Also
ScrollToRowColumnIndex(Int32, Int32, ScrollToPosition, ScrollToPosition)
Scrolls the SfDataGrid to given row and column index. SfDataGrid scrolls to the given column index, next to the RowHeader column if the ShowRowHeader is true.
Declaration
public void ScrollToRowColumnIndex(int rowIndex, int columnIndex, ScrollToPosition scrollToRowPosition, ScrollToPosition scrollToColumnPosition)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The destination row index to scroll. |
System.Int32 | columnIndex | The destination column index to scroll. |
ScrollToPosition | scrollToRowPosition | Determines the position of the scrolled row in the datagrid. The default value is Start. |
ScrollToPosition | scrollToColumnPosition | Determines the position of the scrolled column in the datagrid. The default value is Start. |
Remarks
SfDataGrid supports programmatic scrolling. The user can scroll to the required row and column by using this method.
See Also
ScrollToRowIndex(Int32, ScrollToPosition)
Scrolls the SfDataGrid to the row at the given index.
Declaration
public void ScrollToRowIndex(int rowIndex, ScrollToPosition scrollToRowPosition)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The destination row index to scroll. |
ScrollToPosition | scrollToRowPosition | Determines the position of the scrolled row in the datagrid. The default value is Start. |
Remarks
SfDataGrid supports programmatic scrolling. The user can scroll to the required row by using this method.
See Also
SetItemsSource(Object)
Sets the ItemsSource property of the grid. This method is used to set the ItemsSource of the grid.
Declaration
public void SetItemsSource(object source)
Parameters
Type | Name | Description |
---|---|---|
System.Object | source | The source collection that is passed by the user to be set as SfDataGrid's ItemsSource. |
UnWireEvents()
UnWires the events in the GridModel.
Declaration
protected virtual void UnWireEvents()
WireEvents()
Wires the events in the GridModel.
Declaration
protected virtual void WireEvents()
Events
AutoGeneratingColumn
Occurs when AutoGenerateColumnsis set as true. Using this event, the user can customize the columns being generated automatically.
Declaration
public event AutoGeneratingColumnEventHandler AutoGeneratingColumn
Event Type
Type |
---|
AutoGeneratingColumnEventHandler |
Examples
dataGrid.AutoGeneratingColumn += DataGrid_AutoGeneratingColumn;
void DataGrid_AutoGeneratingColumn (object sender, AutoGeneratingColumnArgs e)
{
//You can achieve your requirement here.
}
See Also
ColumnResizing
Occurs when a column's width is being resized in SfDataGrid.
Declaration
public event GridResizingEventHandler ColumnResizing
Event Type
Type |
---|
GridResizingEventHandler |
Remarks
You can cancel or customize the column being resized through GridResizingEventArgs arguments.
Examples
dataGrid.ColumnResizing += DataGrid_ColumnResizing;
void DataGrid_ColumnResizing (object sender, GridResizingEventArgs e)
{
//You can achieve your requirement here.
}
CurrentCellActivated
Occurs when the current cell is activated in the SfDataGrid
Declaration
public event EventHandler<CurrentCellActivatedEventArgs> CurrentCellActivated
Event Type
Type |
---|
System.EventHandler<CurrentCellActivatedEventArgs> |
Remarks
This event occurs after the CurrentCellActivatingEventArgs event if that event is not canceled.
Examples
dataGrid.CurrentCellActivated += DataGrid_CurrentCellActivated;
void DataGrid_CurrentCellActivated(object sender, CurrentCellActivatedEventArgs e)
{
You can achieve your requirement here.
}
CurrentCellActivating
Occurs when the current cell is being activated in SfDataGrid.
Declaration
public event EventHandler<CurrentCellActivatingEventArgs> CurrentCellActivating
Event Type
Type |
---|
System.EventHandler<CurrentCellActivatingEventArgs> |
Remarks
You can cancel the current cell from being activated using the CurrentCellActivatingEventArgs
Examples
dataGrid.CurrentCellActivating += DataGrid_CurrentCellActivating;
void DataGrid_CurrentCellActivated(object sender, CurrentCellActivatedEventArgs e)
{
You can achieve your requirement here.
}
CurrentCellBeginEdit
Occurs when entering edit mode on a grid cell in SfDataGrid.
Declaration
public event GridCurrentCellBeginEditEventHandler CurrentCellBeginEdit
Event Type
Type |
---|
GridCurrentCellBeginEditEventHandler |
Remarks
You can cancel the current cell being edited through the GridCurrentCellBeginEditEventArgs arguments.
Examples
dataGrid.CurrentCellBeginEdit += DataGrid_CurrentCellBeginEdit;
void DataGrid_CurrentCellBeginEdit (object sender, GridCurrentCellBeginEditEventArgs e)
{
//You can achieve your requirement here.
}
See Also
CurrentCellEndEdit
Occurs when the edit mode ends for the current cell.
Declaration
public event GridCurrentCellEndEditEventHandler CurrentCellEndEdit
Event Type
Type |
---|
GridCurrentCellEndEditEventHandler |
Remarks
You can cancel committing the edited value through the GridCurrentCellEndEditEventArgs arguments.
Examples
dataGrid.CurrentCellEndEdit += DataGrid_CurrentCellEndEdit;
void DataGrid_CurrentCellEndEdit (object sender, GridCurrentCellEndEditEventArgs e)
{
//You can achieve your requirement here.
}
See Also
GridDoubleTapped
Occurs when the grid is double tapped.
Declaration
public event GridDoubleTappedEventHandler GridDoubleTapped
Event Type
Type |
---|
GridDoubleTappedEventHandler |
Examples
dataGrid.GridDoubleTapped += DataGrid_GridDoubleTapped;
void DataGrid_GridDoubleTapped (object sender, GridDoubleTappedEventArgs e)
{
//You can achieve your requirement here.
}
See Also
GridLoaded
Occurs when the SfDataGrid is loaded.
Declaration
public event GridLoadedEventHandler GridLoaded
Event Type
Type |
---|
GridLoadedEventHandler |
Examples
dataGrid.GridLoaded += DataGrid_GridLoaded;
void DataGrid_GridLoaded (object sender, GridLoadedEventArgs e)
{
//You can achieve your requirement here.
}
See Also
GridLongPressed
Occurs when the SfDataGrid is long pressed.
Declaration
public event GridLongPressedEventHandler GridLongPressed
Event Type
Type |
---|
GridLongPressedEventHandler |
Examples
dataGrid.GridLongPressed += DataGrid_GridLongPressed;
void DataGrid_GridLongPressed (object sender, GridLongPressedEventArgs e)
{
//You can achieve your requirement here.
}
See Also
GridTapped
Occurs when the grid is tapped.
Declaration
public event GridTappedEventHandler GridTapped
Event Type
Type |
---|
GridTappedEventHandler |
Examples
dataGrid.GridTapped += DataGrid_GridTapped;
void DataGrid_GridTapped (object sender, GridTappedEventArgs e)
{
//You can achieve your requirement here.
}
See Also
GridViewCreated
Occurs when the view for a SfDataGrid is created.
Declaration
public event GridViewCreatedEventHandler GridViewCreated
Event Type
Type |
---|
GridViewCreatedEventHandler |
Examples
dataGrid.GridViewCreated += DataGrid_GridViewCreated;
void DataGrid_GridViewCreated (object sender, GridViewCreatedEventArgs e)
{
//You can achieve your requirement here.
}
See Also
GroupCollapsed
Occurs when a group is collapsed in SfDataGrid.
Declaration
public event GroupChangedEventHandler GroupCollapsed
Event Type
Type |
---|
GroupChangedEventHandler |
Remarks
This event occurs after the GroupCollapsing event, if that event is not canceled. This event will not raise when the group is collapsed programmatically.
Examples
dataGrid.GroupCollapsed += DataGrid_GroupCollapsed;
void DataGrid_GroupCollapsed (object sender, GroupChangedEventArgs e)
{
//You can achieve your requirement here.
}
See Also
GroupCollapsing
Occurs when a group is being collapsed in SfDataGrid.
Declaration
public event GroupChangingEventHandler GroupCollapsing
Event Type
Type |
---|
GroupChangingEventHandler |
Remarks
You can cancel or customize the group being collapsed through GroupChangingEventArgs arguments. This event will not raise when the group is collapsed programmatically.
Examples
dataGrid.GroupCollapsing += DataGrid_GroupCollapsing;
void DataGrid_GroupCollapsing (object sender, GroupChangingEventArgs e)
{
//You can achieve your requirement here.
}
See Also
GroupExpanded
Occurs when a group is expanded in SfDataGrid.
Declaration
public event GroupChangedEventHandler GroupExpanded
Event Type
Type |
---|
GroupChangedEventHandler |
Remarks
This event occurs after the GroupExpanding event, if that event is not canceled. This event will not raised when the group is expanded programmatically.
Examples
dataGrid.GroupExpanded += DataGrid_GroupExpanded;
void DataGrid_GroupExpanded (object sender, GroupChangedEventArgs e)
{
//You can achieve your requirement here.
}
See Also
GroupExpanding
Occurs when a group is being expanded in SfDataGrid.
Declaration
public event GroupChangingEventHandler GroupExpanding
Event Type
Type |
---|
GroupChangingEventHandler |
Remarks
You can cancel or customize the group being expanded through GroupChangingEventArgs arguments. This event will not be raised when the group is expanded programmatically.
Examples
dataGrid.GroupExpanding += DataGrid_GroupExpanding;
void DataGrid_GroupExpanding (object sender, GroupChangingEventArgs e)
{
//You can achieve your requirement here.
}
See Also
ItemsSourceChanged
Declaration
public event EventHandler<GridItemsSourceChangedEventArgs> ItemsSourceChanged
Event Type
Type |
---|
System.EventHandler<GridItemsSourceChangedEventArgs> |
ItemsSourceChanging
Declaration
public event EventHandler<GridItemsSourceChangingEventArgs> ItemsSourceChanging
Event Type
Type |
---|
System.EventHandler<GridItemsSourceChangingEventArgs> |
OnScrolled
Occurs when on scrolled.
Declaration
public event GridScrolledEventHandler OnScrolled
Event Type
Type |
---|
GridScrolledEventHandler |
QueryColumnDragging
Occurs when a column is being reordered to a new position.
Declaration
public event QueryColumnDraggingEventHandler QueryColumnDragging
Event Type
Type |
---|
QueryColumnDraggingEventHandler |
Remarks
You can cancel or customize the column being dragged through QueryColumnDraggingEventArgs arguments.
Examples
dataGrid.QueryColumnDragging += DataGrid_QueryColumnDragging;
void DataGrid_QueryColumnDragging (object sender, QueryColumnDraggingEventArgs e)
{
//You can achieve your requirement here.
}
See Also
QueryRowDragging
Occurs when a row is being reordered to a new position.
Declaration
public event QueryRowDraggingEventHandler QueryRowDragging
Event Type
Type |
---|
QueryRowDraggingEventHandler |
Remarks
You can cancel or customize the row being dragged through QueryRowDraggingEventArgs arguments.
Examples
dataGrid.QueryRowDragging += DataGrid_QueryRowDragging;
void DataGrid_QueryRowDragging (object sender, QueryRowDraggingEventArgs e)
{
//You can achieve your requirement here.
}
See Also
QueryRowHeight
Occurs when the row height of SfDataGrid is queried for each row data.
Declaration
public event QueryRowHeightEventHandler QueryRowHeight
Event Type
Type |
---|
QueryRowHeightEventHandler |
Remarks
SfDataGrid supports auto row height feature, by using this event. The user can query row the row height based on its content and set the queried height as its row height.
Examples
dataGrid.QueryRowHeight += DataGrid_QueryRowHeight;
void DataGrid_QueryRowHeight (object sender, QueryRowHeightEventArgs e)
{
//You can achieve your requirement here.
}
See Also
QueryUnboundColumnValue
Occurs to query or commit the values for GridUnboundColumn when its cells is initialized or the value is committed.
Declaration
public event QueryUnboundColumnValueHandler QueryUnboundColumnValue
Event Type
Type |
---|
QueryUnboundColumnValueHandler |
Examples
dataGrid.QueryUnboundColumnValue += DataGrid_QueryUnboundColumnValue;
void DataGrid_QueryUnboundColumnValue (object sender, GridUnboundColumnEventArgs e)
{
//You can achieve your requirement here.
}
See Also
QueryUnboundRow
Occurs to query and commit the value and settings for cell in Unbound row.
Declaration
public event EventHandler<GridUnboundRowEventArgs> QueryUnboundRow
Event Type
Type |
---|
System.EventHandler<GridUnboundRowEventArgs> |
Examples
private void DataGrid_QueryUnboundRow(object sender, GridUnboundRowEventArgs e)
{
//You can achieve your requirement here.
}
ScrollStateChanged
Occurs when the SfDataGrid's scrolling state is changed.
Declaration
public event EventHandler<ScrollStateChangedEventArgs> ScrollStateChanged
Event Type
Type |
---|
System.EventHandler<ScrollStateChangedEventArgs> |
Examples
dataGrid.ScrollStateChanged += DataGrid_ScrollStateChanged;
void DataGrid_ScrollStateChanged (object sender, ScrollStateChangedEventArgs e)
{
//You can achieve your requirement here.
}
SelectionChanged
Occurs when selection is changed in SfDataGrid.
Declaration
public event GridSelectionChangedEventHandler SelectionChanged
Event Type
Type |
---|
GridSelectionChangedEventHandler |
Remarks
This event will raise only when the selection is done. This event will not raise if the selection is canceled in the SelectionChanging event.
Examples
dataGrid.SelectionChanged += DataGrid_SelectionChanged;
void DataGrid_SelectionChanged (object sender, GridSelectionChangedEventArgs e)
{
//You can achieve your requirement here.
}
See Also
SelectionChanging
Occurs when the selection is changing in SfDataGrid.
Declaration
public event GridSelectionChangingEventHandler SelectionChanging
Event Type
Type |
---|
GridSelectionChangingEventHandler |
Remarks
The user can cancel the selection by using this event.
Examples
dataGrid.SelectionChanging += DataGrid_SelectionChanging;
void DataGrid_SelectionChanging (object sender, GridSelectionChangingEventArgs e)
{
//You can achieve your requirement here.
}
See Also
SortColumnsChanged
Occurs after the columns is sorted in SfDataGrid.
Declaration
public event DataGridSortColumnsChangedEventHandler SortColumnsChanged
Event Type
Type |
---|
DataGridSortColumnsChangedEventHandler |
Remarks
This event will raise only when the sorting is done. This event will not raise if the sorting is canceled in the SortColumnsChanging event.
Examples
dataGrid.SortColumnsChanged += DataGrid_SortColumnsChanged;
void DataGrid_SortColumnsChanged (object sender, DataGridSortColumnsChangedEventArgs e)
{
//You can achieve your requirement here.
}
See Also
SortColumnsChanging
Occurs when the columns is being sorted in SfDataGrid.
Declaration
public event DataGridSortColumnsChangingEventHandler SortColumnsChanging
Event Type
Type |
---|
DataGridSortColumnsChangingEventHandler |
Remarks
The user can cancel the sorting based on the columns being sorted by using this event.
Examples
dataGrid.SortColumnsChanging += DataGrid_SortColumnsChanging;
void DataGrid_SortColumnsChanging (object sender, DataGridSortColumnsChangingEventArgs e)
{
//You can achieve your requirement here.
}
See Also
SwipeEnded
Occurs when swiping is ended in SfDataGrid.
Declaration
public event SwipeEndedEventHandler SwipeEnded
Event Type
Type |
---|
SwipeEndedEventHandler |
Examples
dataGrid.SwipeEnded += DataGrid_SwipeEnded;
void DataGrid_SwipeEnded (object sender, SwipeEndedEventArgs e)
{
//You can achieve your requirement here.
}
See Also
SwipeStarted
Occurs when swiping is started in SfDataGrid.
Declaration
public event SwipeStartedEventHandler SwipeStarted
Event Type
Type |
---|
SwipeStartedEventHandler |
Examples
dataGrid.SwipeStarted += DataGrid_SwipeStarted;
void DataGrid_SwipeStarted (object sender, SwipeStartedEventArgs e)
{
//You can achieve your requirement here.
}
See Also
Swiping
Occurs when swiping is in progress in SfDataGrid.
Declaration
public event SwipingEventHandler Swiping
Event Type
Type |
---|
SwipingEventHandler |
Examples
dataGrid.Swiping += DataGrid_Swiping;
void DataGrid_Swiping (object sender, SwipingEventArgs e)
{
//You can achieve your requirement here.
}
See Also
ValueChanged
Event that handles the toggle changes of switches
Declaration
public event EventHandler<ValueChangedEventArgs> ValueChanged
Event Type
Type |
---|
System.EventHandler<ValueChangedEventArgs> |
Examples
switchColumn.ValueChanged += Column_ValueChanged;
void Column_ValueChanged(object sender, ValueChangedEventArgs e)
{
//You can achieve your requirement here.
}