Skip to main content
A newer version of this page is available. .

DataGridView Members

A data grid view.

Constructors

Name Description
DataGridView() Initializes a new instance of the DataGridView class.

Fields

Name Description
ActualFilterStringProperty static Identifies the ActualFilterString bindable property.
AdvancedColumnLayoutProperty static Identifies the AdvancedColumnLayout bindable property.
AllowCascadeTreeCreationProperty static Identifies the AllowCascadeTreeCreation bindable property.
AllowCascadeUpdateProperty static Identifies the AllowCascadeUpdate bindable property.
AllowDragDropRowsProperty static Identifies the AllowDragDropRows bindable property.
AllowDragDropSortedRowsProperty static Identifies the AllowDragDropSortedRows bindable property.
AllowGroupCollapseProperty static Identifies the AllowGroupCollapse bindable property.
AllowInitiallySelectedRowProperty static Identifies the AllowInitiallySelectedRow bindable property.
AllowLiveDataShapingProperty static Identifies the AllowLiveDataShaping bindable property.
AllowSortProperty static Identifies the AllowSort bindable property.
AllowVirtualHorizontalScrollingProperty static Identifies the AllowVirtualHorizontalScrolling bindable property.
AutoExpandAllGroupsProperty static Identifies the AutoExpandAllGroups bindable property.
AutoFilterRowHandle Gets or sets the Auto Filter Row’s handle.
AutoFilterRowHeightProperty static Identifies the AutoFilterRowHeight bindable property.
AutoGenerateColumnsModeProperty static Identifies the AutoGenerateColumnsMode bindable property.
BorderColorProperty static Identifies the BorderColor bindable property.
BorderThicknessProperty static Identifies the BorderThickness bindable property.
CellAppearanceProperty static Identifies the CellAppearance bindable property.
ColumnHeaderAppearanceProperty static Identifies the ColumnHeaderAppearance bindable property.
ColumnHeaderContentTemplateProperty static Identifies the ColumnHeaderContentTemplate bindable property.
ColumnHeaderHeightProperty static Identifies the ColumnHeaderHeight bindable property.
EditColumnProperty static Identifies the EditColumn bindable property.
EditItemProperty static Identifies the EditItem bindable property.
EditorShowModeProperty static Identifies the EditorShowMode bindable property.
EditRowHandleProperty static Identifies the EditRowHandle bindable property.
FilterExpressionProperty static Identifies the FilterExpression bindable property.
FilterIconColorProperty static Identifies the FilterIconColor bindable property.
FilterStringProperty static Identifies the FilterString bindable property.
FixedColumnSeparatorThicknessProperty static Identifies the FixedColumnSeparatorThickness bindable property.
FullSwipeModeProperty static Identifies the FullSwipeMode bindable property.
GroupCaptionTemplateProperty static Identifies the GroupCaptionTemplate bindable property.
GroupRowAppearanceProperty static Identifies the GroupRowAppearance bindable property.
GroupRowHeightProperty static Identifies the GroupRowHeight bindable property.
GroupRowTemplateProperty static Identifies the GroupRowTemplate bindable property.
GroupSummaryTemplateProperty static Identifies the GroupSummaryTemplate bindable property.
IndicatorColorProperty static Identifies the IndicatorColor bindable property.
InvalidRowHandle An invalid row handle. This value is returned when trying to access a row that does not exist in the grid.
IsColumnHeaderVisibleProperty static Identifies the IsColumnHeaderVisible bindable property.
IsEditingProperty static Identifies the IsEditing bindable property.
IsHorizontalScrollBarVisibleProperty static Identifies the IsHorizontalScrollBarVisible bindable property.
IsLoadMoreEnabledProperty static Identifies the IsLoadMoreEnabled bindable property.
IsPullToRefreshEnabledProperty static Identifies the IsPullToRefreshEnabled bindable property.
IsReadOnlyProperty static Identifies the IsReadOnly bindable property.
IsRefreshingProperty static Identifies the IsRefreshing bindable property.
IsVerticalScrollBarVisibleProperty static Identifies the IsVerticalScrollBarVisible bindable property.
ItemsSourceProperty static Identifies the ItemsSource bindable property.
LoadMoreCommandProperty static Identifies the LoadMoreCommand bindable property.
PullToRefreshCommandProperty static Identifies the PullToRefreshCommand bindable property.
ReduceHeightToContentProperty static Identifies the ReduceHeightToContent bindable property.
RestoreCollectionsModeProperty static Identifies the RestoreCollectionsMode bindable property.
RowDragPreviewShadowColorProperty static Identifies the RowDragPreviewShadowColor bindable property.
RowDragPreviewTemplateProperty static Identifies the RowDragPreviewTemplate bindable property.
RowHeightProperty static Identifies the RowHeight bindable property.
RowTapCommandProperty static Identifies the RowTapCommand bindable property.
SelectedItemProperty static Identifies the SelectedItem bindable property.
SelectedRowHandleProperty static Identifies the SelectedRowHandle bindable property.
SelectionModeProperty static Identifies the SelectionMode bindable property.
ShowAutoFilterRowProperty static Identifies the ShowAutoFilterRow bindable property.
ShowFilterIconProperty static Identifies the ShowFilterIcon bindable property.
ShowGroupedColumnsProperty static Identifies the ShowGroupedColumns bindable property.
SortModeProperty static Identifies the SortMode bindable property.
SwipeItemAppearanceProperty static Identifies the SwipeItemAppearance bindable property.
SwipeItemTemplateProperty static Identifies the SwipeItemTemplate bindable property.
TotalSummaryAppearanceProperty static Identifies the TotalSummaryAppearance bindable property.
TotalSummaryHeightProperty static Identifies the TotalSummaryHeight bindable property.
TotalSummaryTemplateProperty static Identifies the TotalSummaryTemplate bindable property.
TotalSummaryVisibilityProperty static Identifies the TotalSummaryVisibility bindable property.
UnspecifiedHeight
VerticalLineThicknessProperty static Identifies the VerticalLineThickness bindable property.

Properties

Name Description
ActualAppearance Gets the common appearance settings that are applied to the current DataGridView.
ActualFilterString Gets the string that specifies a filter used in the grid. This is a bindable property.
AdvancedColumnLayout Gets or sets whether the grid displays its rows in multiple lines. This is a bindable property.
AllowCascadeTreeCreation Gets or sets whether the grid performs deferred data loading on start. This is a bindable property.
AllowCascadeUpdate Gets or sets whether the grid performs deferred data loading while it is scrolled vertically. This is a bindable property.
AllowDragDropRows Gets or sets whether a user is allowed to drag and drop data rows within the grid. This is a bindable property.
AllowDragDropSortedRows Gets or sets whether a user is allowed to drag and drop data rows that are sorted or grouped. This is a bindable property.
AllowGroupCollapse Gets or sets whether users can collapse and expand groups of rows. This is a bindable property.
AllowInitiallySelectedRow Gets or sets whether the first row is selected when the view is displayed on-screen for the first time. This is a bindable property.
AllowLiveDataShaping Gets or sets whether the DataGridView refreshes itself if the data source notifies the control of value changes. The control re-shapes its data: changes the sort order, applies filter conditions, calculates summaries, and carries out other necessary updates. This functionality is available for item source objects that implement the INotifyPropertyChanged interface. This is a bindable property.
AllowSort Gets or sets whether users can sort data in the grid. This is a bindable property.
AllowVirtualHorizontalScrolling Gets or sets whether virtual horizontal scrolling is activated. This is a bindable property.
AutoExpandAllGroups
AutoFilterRowHeight Gets or sets the Auto Filter Row’s height. This is a bindable property.
AutoGenerateColumnsMode Gets or sets whether columns should be automatically created for fields of the underlying data source, depending on whether the grid contains any columns. This is a bindable property.
BorderColor Gets or sets the grid border color. This is a bindable property.
BorderThickness Gets or sets the grid border thickness. This is a bindable property.
CellAppearance Gets or sets the appearance settings that are applied to the current DataGridView‘s cells. This is a bindable property.
ColumnHeaderAppearance Gets or sets the appearance settings that are applied to the current DataGridView‘s column headers. This is a bindable property.
ColumnHeaderContentTemplate Gets or sets the template that defines the visual representation of column headers. This is a bindable property.
ColumnHeaderHeight Gets or sets the height of column headers in the grid. This is a bindable property.
Columns Provides access to the grid’s collection of columns.
EditColumn
EditItem
EditorShowMode Gets or sets a gesture by which a user can invoke an in-place editor for a data cell. This is a bindable property.
EditRowHandle
EndSwipeItems Provides access to objects that contain information on action buttons shown on the right side of a data row when a user swipes the row from right to left.
FilterExpression Gets or sets the grid’s filter expression. This is a bindable property.
FilterIconColor Gets or sets a color of the filter icon. This is a bindable property.
FilterString Gets or sets the grid’s filter expression string. This is a bindable property.
FixedColumnSeparatorThickness Gets or sets the thickness of the line that separates fixed and scrollable columns. This is a bindable property.
FullSwipeMode Gets or sets whether a full swipe across the row performs the first action from the grid’s StartSwipeItems or EndSwipeItems collection. This is a bindable property.
GroupCaptionTemplate Gets or sets the template that defines the visual representation of a group row caption. This is a bindable property.
GroupCount Returns the number of data row groups within a grid.
GroupRowAppearance Gets or sets the appearance settings that are applied to the current DataGridView‘s group row. This is a bindable property.
GroupRowHeight Gets or sets the height of group rows in the grid. This is a bindable property.
GroupRowTemplate Gets or sets the template that defines the visual representation of group rows. This is a bindable property.
GroupSummaries Provides access to the collection of group summary items.
GroupSummaryTemplate Gets or sets the template that defines the visual representation of summary items displayed within group rows. This is a bindable property.
IndicatorColor Gets or sets the color of the load-more (iOS and Android) and pull-to-refresh (iOS only) indicators. This is a bindable property.
IsColumnHeaderVisible Gets or sets whether column headers are shown in the grid. This is a bindable property.
IsEditing Gets whether the focused cell is currently being edited. This is a bindable property.
IsGrouped Returns whether the grid’s data is grouped.
IsHorizontalScrollBarVisible Gets or sets whether the horizontal scrollbar is shown in the grid. This is a bindable property.
IsInitialized Gets whether the DataGridView‘s instance is initialized.
IsLoadMoreEnabled Gets or sets whether the load-more functionality is enabled in the grid. This is a bindable property.
IsPullToRefreshEnabled Gets or sets whether the pull-to-refresh functionality is enabled in the grid. This is a bindable property.
IsReadOnly Gets or sets whether the grid is read-only. This is a bindable property.
IsRefreshing Allows you to hide the refresh or load indicator that the grid displays when executing the pull-to-refresh or load-more operation.
IsVerticalScrollBarVisible Gets or sets whether the vertical scrollbar is shown in the grid. This is a bindable property.
ItemsSource Gets or sets the grid’s data source. This is a bindable property.
LoadMoreCommand Gets or sets the command executed when a user scrolls to the bottom of the grid to load new data items. This is a bindable property.
PullToRefreshCommand Gets or sets the command executed when a user pulls the grid down to request content update. This is a bindable property.
ReduceHeightToContent Gets or sets whether the grid reduces its height to occupy the minimum space needed for its data rows. This is a bindable property.
RestoreCollectionsMode
RowDragPreviewShadowColor Gets or sets the shadow color of the dragged row preview. This is a bindable property.
RowDragPreviewTemplate Gets or sets the template that defines the visual representation of the dragged row preview displayed during the drag-and-drop operation. This is a bindable property.
RowHeight Gets or sets the height of data rows in the grid. This is a bindable property.
RowTapCommand Gets or sets the command executed when a user taps a row within the grid. This is a bindable property.
SelectedItem Returns an object that specifies a data source record to which a data row currently selected in the grid corresponds. This is a bindable property.
SelectedRowHandle Gets or sets the selected row handle. This is a bindable property.
SelectionMode Gets or sets whether end users can select rows in the grid. This is a bindable property.
ShowAutoFilterRow Gets or sets whether to display the Auto Filter Row, which allows a user to enter a value in a column to automatically filter values in this column according to a filter condition. This is a bindable property.
ShowFilterIcon Gets or sets whether to show the filter icons in the Auto Filter Row’s cells. This is a bindable property.
ShowGroupedColumns Gets or sets whether the grid displays a column used to group data. This is a bindable property.
SortMode Gets or sets whether the grid allows data sorting by multiple columns or by a single column only. This is a bindable property.
StartSwipeItems Provides access to objects that contain information on action buttons shown on the left side of a data row when a user swipes the row from left to right.
SwipeItemAppearance Gets or sets the appearance settings that are applied to the current DataGridView‘s swipe items. This is a bindable property.
SwipeItemTemplate Gets or sets the template that defines the visual representation of grid’s swipe items. This is a bindable property.
TotalSummaries Provides access to the collection of total summary items.
TotalSummaryAppearance Gets or sets the appearance settings that are applied to the current DataGridView‘s total summary items. This is a bindable property.
TotalSummaryHeight Gets or sets the total summary panel height. This is a bindable property.
TotalSummaryTemplate Gets or sets the template that defines the visual representation of total summary items. This is a bindable property.
TotalSummaryVisibility Gets or sets whether the total summary panel is displayed. This is a bindable property.
VerticalLineThickness Gets or sets the thickness of the grid’s vertical lines. This is a bindable property.
VisibleColumns Gets the collection of visible columns.
VisibleRowCount Gets the total number of rows displayed within a grid.

Methods

Name Description
BeginUpdate() Locks the grid to prevent its visual updates until the EndUpdate method is called.
ClearColumnAutoFilter(GridColumn) Clears the filter that is set in the auto filter row. To specify the column, pass the column object to the method parameters.
ClearColumnAutoFilter(String) Clears the filter that is set in the auto filter row. To specify the column, pass its underlying field’s name to the method parameters.
ClearColumnFilter(GridColumn) Resets FilterString or FilterExpression applied to the column object passed in the method parameters. The method does not reset a filter set using the Auto Filter Row.
ClearColumnFilter(String) Resets FilterString or FilterExpression applied to the column. To specify the column, pass its underlying field’s name to the method parameters. The method does not reset a filter set using the Auto Filter Row.
ClearFilter() Clears the filter applied to data in the grid.
ClearGrouping() Ungroups data in the grid.
ClearSorting() Clears the sorting applied to the grid.
CloseEditor(Boolean) Closes a cell in-place editor.
CollapseAllGroups(Boolean) Collapses all groups of rows.
CollapseGroupRow(Int32, Boolean) Collapses the specified group of rows.
DeleteRow(Int32) Deletes the specified data row.
EndUpdate() Unlocks the grid after the BeginUpdate method call and forces an immediate visual update.
Equals(Object, Object) static Determines whether the specified object instances are considered equal. Inherited from Object.
Equals(Object) Determines whether the specified object is equal to the current object. Inherited from Object.
ExpandAllGroups(Boolean) Expands all groups of rows.
ExpandGroupRow(Int32, Boolean) Expands the specified group of rows.
FindRowHandle(Object) Returns the handle of the DataGridView row that corresponds to a data object passed in the parameters.
FindRowHandle(Predicate<Object>) Returns the handle of the first row that matches the specified criteria.
FindRowHandle(String, Object) Searches for the value in the column and returns the handle of the corresponding row.
GetCellDisplayText(Int32, GridColumn) Gets the text displayed within the specified cell.
GetCellDisplayText(Int32, String) Gets the text displayed within the specified cell.
GetCellValue(Int32, GridColumn) Returns the value of the specified data cell.
GetCellValue(Int32, String) Returns the value of the specified data cell.
GetChildRowCount(Int32) Returns the number of data rows in a specific group.
GetChildRowHandle(Int32, Int32) Returns the handle of a row at the specified position within the specified group.
GetGroupDisplayText(Int32) Returns an actual or formatted value displayed in the specified group row (group header).
GetGroupSummaryValue(Int32, GridColumnSummary) Returns a summary value calculated against the specified group of rows.
GetGroupValue(Int32) Returns an actual value displayed in the specified group row (group header).
GetHashCode() Serves as the default hash function. Inherited from Object.
GetParentRowHandle(Int32) Returns the group row handle that identifies the group to which the specified data row belongs.
GetRowHandle(Int32) Returns the handle of the row that corresponds to the specified record in the data source.
GetRowHandleByVisibleIndex(Int32) Returns a row’s handle by its visible index.
GetRowItem(Int32) Returns an object that represents a record in the grid’s underlying data source.
GetRowItemBySourceIndex(Int32) Returns the data source object by its index.
GetRowSourceIndex(Int32) Gets the index of the data source record to which the specified row handle corresponds.
GetRowVisibleIndex(Int32) Returns the row’s position within a DataGridView by its handle.
GetTotalSummaryValue(GridColumnSummary) Returns the value of the specified total summary item.
GetType() Gets the Type of the current instance. Inherited from Object.
GroupBy(GridColumn) Groups data in the grid by the specified column.
GroupBy(String) Groups data in the grid by the specified column.
Initialize() Initializes the DataGridView from XAML.
IsGroupCollapsed(Int32) Indicates whether the specified group row is collapsed.
IsGroupRow(Int32) Checks whether the specified row is a group row.
MemberwiseClone() protected Creates a shallow copy of the current Object. Inherited from Object.
MergeColumnFilters(CriteriaOperator) Combines the specified filter with the grid’s current filter with the AND operator.
MergeColumnFilters(String) Combines the specified filter with the grid’s current filter with the AND operator.
MoveRow(Int32, Int32, Action)
OpenEditor(Int32, String) Invokes an in-place editor for the specified cell.
ReferenceEquals(Object, Object) static Determines whether the specified Object instances are the same instance. Inherited from Object.
RefreshData() Updates the grid’s data.
RefreshRow(Int32) Refreshes the row specified by its handle.
ScrollToColumn(GridColumn)
ScrollToColumn(Int32)
ScrollToRow(Int32) Scrolls the grid to make the specified row visible.
SetCellValue(Int32, GridColumn, Object) Sets the specified cell’s value.
SetCellValue(Int32, String, Object) Sets the specified cell’s value.
SortBy(GridColumn, DataSortOrder, Int32) Sorts data by values of the specified column in the specified order, and places the column at the specified position among the sorted columns.
SortBy(String, DataSortOrder, Int32) Sorts data by values of the specified column in the specified order, and places the column at the specified position among the sorted columns.
ToString() Returns a string that represents the current object. Inherited from Object.

Events

Name Description
AutoGeneratingColumn Occurs each time an individual column is generated automatically.
CompleteRowDragDrop Occurs after the drag-and-drop operation is completed.
CustomCellAppearance Occurs before a data cell is painted.
CustomCellDisplayText
CustomFilter Allows you to apply custom filter rules to grid rows.
CustomGroup Enables you to group data in a custom manner.
CustomGroupDisplayText Allows you to customize text for group rows.
CustomSort Enables you to sort data in a custom manner.
CustomSummary Allows you to specify a custom rule to calculate data summaries.
CustomUnboundData Enables you to populate unbound columns with data, and save changes that users made in unbound columns.
DoubleTap Occurs when a user double taps the grid.
DragRow Occurs when users touch and hold a data row to drag it.
DragRowOver Occurs each time a row is over another row when being dragged.
DropRow Occurs when users drop a row.
EditorShowing Fires when a cell editor is about to be displayed and allows you to cancel the action.
GroupCollapsed Occurs after a group of rows has been collapsed.
GroupCollapsing Occurs before a group of rows is collapsed.
GroupExpanded Occurs after a group of rows has been expanded.
GroupExpanding Occurs before a group of rows is expanded.
LoadMore Occurs when a user scrolls to the bottom of the grid to load new data items.
LongPress Occurs when a user taps and holds anywhere within the grid.
PullToRefresh Occurs when a user pulls the grid down to refresh its content.
SelectionChanged Occurs after the selected row has been changed in the grid.
SwipeItemShowing Fires when a swipe item is about to be shown when a user swipes a row from left to right or from right to left, and allows you to cancel the action.
Tap Occurs when a user taps the grid.
TapConfirmed Occurs when a single tap is confirmed (a user tapped the grid and a second tap leading to the double-tap gesture did not follow).
ValidateCell Occurs after a user changes a cell value in the in-place editor and attempts to select another cell.
ValidationError Occurs when a value in the in-place cell editor fails validation or when it cannot be saved to a data source.
See Also