mobilecontrols-401659-xamarin-forms-data-grid-migration.md
This document compares the DataGridView for Xamarin.Forms with the legacy GridControl, and describes the differences in features, API, and behavior of these controls.
This table lists features of the new DataGridView that the legacy GridControl does not support:
|
Feature
|
Related API
| | --- | --- | |
|
DataGridView.ValidateCell
DataGridView.ValidationError
EditFormPage.ValidateCell
EditFormPage.ValidateForm
| |
|
DataGridView.ColumnHeaderContentTemplate / GridColumn.HeaderContentTemplate
DataGridView.GroupCaptionTemplate / GridColumn.GroupCaptionTemplate
DataGridView.GroupRowTemplate
DataGridView.GroupSummaryTemplate
DataGridView.SwipeItemTemplate / SwipeItem.Template
DataGridView.TotalSummaryTemplate / GridColumn.TotalSummaryTemplate
| |
|
DataGridView.AdvancedColumnLayout
AdvancedColumnLayout.ColumnDefinitions / AdvancedColumnLayout.RowDefinitions
GridColumn.Row / GridColumn.Column
GridColumn.RowSpan / GridColumn.ColumnSpan
| |
|
DataGridView.AllowDragDropRows / DataGridView.AllowDragDropSortedRows
DataGridView.RowDragPreviewTemplate
DataGridView.RowDragPreviewShadowColor
DataGridView.DragRow
DataGridView.DragRowOver
DataGridView.DropRow
DataGridView.CompleteRowDragDrop
| |
Row Auto Height
|
DataGridView.RowHeight
DataGridView.GroupRowHeight
If these properties are set to -1 , the grid adjusts the height of rows to display cells’ content.
| |
Cascade Data Update
|
DataGridView.AllowCascadeUpdate
DataGridView.AllowCascadeTreeCreation
| |
Column Header Visibility
|
DataGridView.IsColumnHeaderVisible
| |
Scrollbar Visibility
|
DataGridView.IsHorizontalScrollBarVisible
DataGridView.IsVerticalScrollBarVisible
| |
Column’s Properties
|
EditFormCaption
GroupCaptionDisplayFormat
HeaderCaptionLineBreakMode
HorizontalContentAlignment
MaxWidth
| |
Grid’s Visual Updates
|
DataGridView.IsUpdateLocked
DataGridView.BeginUpdate() / DataGridView.EndUpdate()
| |
Refresh Indicator Visibility
|
| |
Grouping-Related API
|
DataGridView.GetGroupValue(Int32)
DataGridView.GetGroupDisplayValue(Int32)
DataGridView.GetGroupSummaryValue(Int32, GridColumnSummary)
DataGridView.GetChildRowCount(Int32)
DataGridView.GetChildRowHandle(Int32, Int32)
|
The following table lists the GridControl‘s features that the new DataGridView does not support:
|
Feature
|
Related API
| | --- | --- | |
|
GridControl.NewItemRowVisibility
GridControl.InitNewRow
| |
|
GridControl.FilterPanelVisibility
GridControl.FilterPanelHeight
| |
Popup Menu
|
GridControl.PopupMenuCustomization
GridControl.AllowDeleteRows
GridControl.AllowEditRows
GridControl.AllowGroup
GridColumn.AllowGroup
GridControl.HighlightMenuTargetElements
GridControl.IsColumnMenuEnabled
GridControl.IsGroupRowMenuEnabled
GridControl.IsRowCellMenuEnabled
GridControl.IsTotalSummaryMenuEnabled
| |
|
GridControl.IsColumnChooserEnabled
GridControl.ShowColumnChooser()
GridControl.HideColumnChooser()
| |
Resizing Columns from UI
|
GridControl.AllowResizeColumns
| |
Horizontal Scrolling Virtualization
|
GridControl.AllowHorizontalScrollingVirtualization
| |
|
| |
Export to Excel
|
GridControl.ExportToExcel(Stream, ExportTarget)
GridControl.OptionsExportXls
GridControl.OptionsExportXlsx
GridControl.OptionsExportCsv
| |
Miscellaneous
|
GridControl.FindRowByValue(GridColumn, Object)
GridControl.Redraw(Boolean)
GridControl.Dispose()
GridControl.LoadInVisualTree()
GridControl.FilterApplied
GridControl.HorizontalScrollOffsetChanged
CustomizeCellDisplayTextEventArgs.Source
| |
Grouping-Related API
|
GridControl.GetGroupInfo(Int32)
IGroupInfo
|
This section describes differences in implementation and behavior of the functionality that the DataGridView and GridControl support.
|
Editor
|
DataGridView (New) Learn more…
|
GridControl (Legacy) Learn more…
| | --- | --- | --- | |
In-place
|
In-place cell editor
The grid automatically commits the edited cell value when a user taps outside the cell being edited.
Use the DataGridView.EditorShowMode property to specify a gesture that invokes an in-place editor for a cell.
|
In-place row editor
The grid invokes the in-place row editor (RowEditMode = Inplace) when a user double taps a data cell.
| | | |
Edit Form
|
To allow users to edit cell values via an edit form, create an EditFormPage instance and handle the grid’s event (for example, Tap or DoubleTap) to specify a gesture that invokes the edit form.
|
The grid invokes an edit form according to the RowEditMode property value. To replace the default row edit form with a custom form, use the EditFormContent property.
| | | |
GridControl.AllowEditRows - Specifies whether users are allowed to change cell values in the grid.
|
The new grid automatically performs the load-more operation unless data rows fill the entire viewport or the number of visible rows does not change.
|
DataGridView (New) Learn more…
|
GridControl (Legacy) Learn more…
| | --- | --- | |
DataGridView.StartSwipeItems
DataGridView.EndSwipeItems
SwipeItem
|
GridControl.LeftSwipeButtons
GridControl.RightSwipeButtons
SwipeButtonInfo
| |
|
GridControl.SwipeButtonClick
GridControl.SwipeButtonCommand
| |
|
GridControl.SwipeButtonShowing
| |
The grid can display an icon within a swipe item and
use a custom template that defines a swipe item’s appearance.
|
| |
|
|
|
DataGridView (New) Learn more…
|
GridControl (Legacy) Learn more…
| | --- | --- | |
Light and Dark built-in themes
using Xamarin.Forms;
using DevExpress.XamarinForms.Core.Themes;
// ...
ThemeManager.ThemeName = Theme.Dark;
|
Light and Dark built-in themes
using Xamarin.Forms;
using DevExpress.Mobile.DataGrid.Theme;
// ...
ThemeManager.ThemeName = Themes.Dark;
| |
When the ThemeManager applies a theme, it adds implicit styles for a grid and its elements to the application’s ResourceDictionary.
You can use special target types (for example, CellStyle, GroupRowStyle, ColumnHeaderStyle, etc.) to create custom styles lower in the view hierarchy so that these styles override original styles (defined at the application level). All grids for which the corresponding resource is available uses these custom styles. You can also apply a custom style to a specific grid instance. To do this, use this grid’s *Style properties (CellStyle, GroupRowStyle, ColumnHeaderStyle, etc.).
Learn more…
|
To customize the applied theme, use the ThemeBase class. Its properties provide access to different customizers that you can use to change appearance settings (for example, font attributes, border and background colors, etc.) of the grid’s visual elements (data cells, group rows, filter panel, etc.).
Learn more…
|
|
|
DataGridView (New)
|
GridControl (Legacy)
| | --- | --- | --- | |
API
|
GridColumn.Width - Specifies the column width as a GridLength value. Allows you to define absolute (for example, 50 ) or proportional (for example, 2* ) width value, but does not support the Auto option.
GridColumn.MinWidth
GridColumn.MaxWidth
|
GridControl.ColumnsAutoWidth
GridColumn.Width - Specifies the column width in density-independent pixels.
| |
Behavior
|
The grid adjusts column widths so that the total width of all columns equals the grid’s width. When you set the Width property for a column, the grid automatically changes the widths of other columns. To specify the minimum and maximum column width, use the MinWidth and MaxWidth properties. If the total column width exceeds the grid’s width, horizontal scrolling is enabled.
|
ColumnsAutoWidth = true
The grid adjusts column widths so that the total width of all columns equals the grid’s width. If you set the Width property only for one column, and there are other columns that do not have this property defined, the grid uses your width value for this column and decreases the widths of columns with an unspecified width. However, if you set the Width for all columns, or if specific columns whose width is not defined already reached their MinWidth value, the grid adjusts the width of all other columns in proportion to their defined Width but not less than MinWidth.
ColumnsAutoWidth = false
A column’s width is specified by its Width property. If the total column width exceeds the grid’s width, horizontal scrolling is enabled.
|
|
DataGridView (New)
|
GridControl (Legacy)
| | --- | --- | |
The grid height is equal to the height of the device’s screen, regardless of the number of data items.
|
The grid can change its height to show all data rows.
|
The new grid’s CustomizeCellDisplayTextEventHandler has a sender parameter.
|
DataGridView (New)
|
GridControl (Legacy)
| | --- | --- | |
Namespace: DevExpress.XamarinForms.*
|
Namespace: DevExpress.Mobile.*
| |
|
| |
Tap
TapConfirmed
DoubleTap
LongPress
|
| |
|
GridControl.SelectedDataObject
| |
DataGridView.GroupCollapsing
DataGridView.GroupExpanding
DataGridView.GroupCollapsed
DataGridView.GroupExpanded
|
GridControl.GroupRowCollapsing
GridControl.GroupRowExpanding
GridControl.GroupRowCollapsed
GridControl.GroupRowExpanded
| |
GridColumn.HorizontalContentAlignment
|
| |
GridColumn.HeaderContentTemplate
|
| |
|
| |
DataGridView.SelectionChanged event’s argument type:
SelectionChangedEventArgs with the Item property
|
GridControl.SelectionChanged event’s argument type:
RowEventArgs
| |
DataGridView.OpenEditor(Int32, String)
|
GridControl.OpenEditor(CellIndex)
| |
|
|