Skip to main content

DataGridView Methods

A data grid view.
Name Description
ApplyBindings() protected Applies all the current bindings to BindingContext. Inherited from BindableObject.
BatchBegin() Signals the start of a batch of changes to the elements properties. This can benefit performance if a bigger number of property values are changed. Inherited from VisualElement.
BatchCommit() Signals the end of a batch of commands to the element and that those commands should now be committed. Inherited from VisualElement.
BeginUpdate() Locks the grid to prevent its visual updates until the EndUpdate method is called.
CalcBestFitAsync(GridColumn, Boolean) Calculates the best-fit width for all columns or for the specified column asynchronously. The CalcBestFitAsync method returns Task that completes when the column width calculates.
ChangeVisualState() protected Changes the current visual state based on this elements current property values. Inherited from VisualElement.
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.
ClearValue(BindableProperty) Clears any value that is previously set for a bindable property. Inherited from BindableObject.
ClearValue(BindablePropertyKey) Clears any value that is previously set for a bindable property, identified by its key. Inherited from BindableObject.
CloseEditor(Boolean) Closes a cell in-place editor.
CoerceValue(BindableProperty)

Coerces the value of the specified bindable property. This is done by invoking BindableProperty.CoerceValueDelegate of the specified bindable property.

Inherited from BindableObject.
CoerceValue(BindablePropertyKey)

Coerces the value of the specified bindable property. This is done by invoking BindableProperty.CoerceValueDelegate of the specified bindable property.

Inherited from BindableObject.
CollapseAllGroups(Boolean) Collapses all groups of rows.
CollapseGroupRow(Int32, Boolean) Collapses the specified group of rows.
DeleteRow(Int32) Deletes the specified data row.
EffectIsAttached(String) For internal use by .NET MAUI. Inherited from Element.
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 System.Object.
Equals(Object) Determines whether the specified object is equal to the current object. Inherited from System.Object.
ExpandAllGroups(Boolean) Expands all groups of rows.
ExpandGroupRow(Int32, Boolean) Expands the specified group of rows.
FindByName(String) Returns the element that has the specified name. Inherited from Element.
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.
Focus() Attempts to set focus to this element. Inherited from VisualElement.
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.
GetChildElements(Point) Gets the child elements that are visually beneath the specified point. Inherited from View.
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 System.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.
GetSelectedRowHandles() Returns the collection of selected row handles.
GetTotalSummaryValue(GridColumnSummary) Returns the value of the specified total summary item.
GetType() Gets the Type of the current instance. Inherited from System.Object.
GetValue(BindableProperty) Returns the value that is contained in the given bindable property. Inherited from BindableObject.
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.
InvalidateMeasure() protected Marks the current measure of an element as invalidated. Inherited from VisualElement.
InvalidateMeasureNonVirtual(InvalidationTrigger) Invalidates the measure of an element. Inherited from VisualElement.
InvalidateMeasureOverride() protected Provides a way to allow subclasses (e.g., Layout) to override InvalidateMeasure() Inherited from VisualElement.
IsGroupCollapsed(Int32) Indicates whether the specified group row is collapsed.
IsGroupRow(Int32) Checks whether the specified row is a group row.
IsSet(BindableProperty) Determines whether or not a bindable property exists and has a value set. Inherited from BindableObject.
Measure(Double, Double, MeasureFlags) Returns the minimum size that an element needs in order to be displayed on the device. Inherited from VisualElement.
MeasureOverride(Double, Double) protected Allows subclasses to implement custom Measure logic during a controls measure pass. Inherited from VisualElement.
MemberwiseClone() protected Creates a shallow copy of the current Object. Inherited from System.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.
IElementController.SetValueFromRenderer(BindableProperty, Object) For internal use by .NET MAUI. Inherited from Element.
MoveRow(Int32, Int32, Action) Moves the row with the specified index to the specified position within the DataGridView with the specified action.
OnChildAdded(Element) protected Invoked when a child object is added to this element. Inherited from VisualElement.
OnChildRemoved(Element, Int32) protected Invoked when a child object is removed from this element. Inherited from VisualElement.
OnChildrenReordered() protected Raises the ChildrenReordered event. Inherited from VisualElement.
OnMeasure(Double, Double) protected Method that is called when a layout measurement happens. Inherited from VisualElement.
OnPropertyChanging(String) protected Raises the PropertyChanging event. Inherited from BindableObject.
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 System.Object.
RefreshData() Updates the grid’s data.
RefreshRow(Int32) Refreshes the row specified by its handle.
RemoveBinding(BindableProperty) Removes a previously set binding from a bindable property. Inherited from BindableObject.
RemoveDynamicResource(BindableProperty) Removes a previously set dynamic resource. Inherited from Element.
ScrollToColumn(GridColumn) Makes the specified column visible onscreen.
ScrollToColumn(Int32) Makes the specified column visible onscreen.
ScrollToRow(Int32) Scrolls the grid to make the specified row visible.
SetBinding(BindableProperty, BindingBase) Assigns a binding to a bindable property. Inherited from BindableObject.
SetCellValue(Int32, GridColumn, Object) Sets the specified cell’s value.
SetCellValue(Int32, String, Object) Sets the specified cell’s value.
SetDynamicResource(BindableProperty, String) Sets the BindableProperty property of this element to be updated via the DynamicResource with the provided key. Inherited from Element.
SetInheritedBindingContext(BindableObject, Object) static Sets the inherited context to a nested element. Inherited from BindableObject.
SetValue(BindableProperty, Object) Sets the value of the specified bindable property. Inherited from BindableObject.
SetValue(BindablePropertyKey, Object) Sets the value of the specified bindable property. Inherited from BindableObject.
SetValueCore(BindableProperty, Object, SetValueFlags) For internal use by the Microsoft.Maui.Controls platform. Inherited from BindableObject.
SetValueFromRenderer(BindableProperty, Object) For internal use by .NET MAUI. Inherited from Element.
SetValueFromRenderer(BindablePropertyKey, Object) For internal use by .NET MAUI. Inherited from Element.
ShowDetailEditForm(Int32, Boolean) Invokes an edit form for a DataGridView row with the specified handle.
ShowDetailForm(Int32, Boolean) Invokes a view form for a DataGridView row with the specified handle.
ShowDetailNewItemForm(Boolean) Invokes a form used to create a new Data Grid View item.
ShowFilteringUIForm() Invokes the form that allows users to filter DataGridView items.
SizeAllocated(Double, Double) protected Method that is called during a layout cycle to signal the start of a sub-tree layout. Inherited from VisualElement.
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 System.Object.
UnapplyBindings() protected Removes all current bindings from the current context. Inherited from BindableObject.
Unfocus() Unsets keyboard focus on this element. Inherited from VisualElement.
See Also