Migrate from Xamarin.Forms SfDataGrid to .NET MAUI SfDataGrid

17 Mar 20233 minutes to read

To make migration from Xamarin SfDataGrid to .NET MAUI SfDataGrid easier, we kept most of the APIs from Xamarin SfDataGrid in MAUI SfDataGrid. However, to maintain the consistency of API naming in MAUI SfDataGrid, we renamed some of the APIs. The APIs that have been changed in MAUI SfDataGrid from Xamarin SfDataGrid are detailed as follows.

Namespaces

Xamarin SfDataGrid .NET MAUI SfDataGrid
Syncfusion.SfDataGrid.XForms Syncfusion.Maui.DataGrid
Syncfusion.Data Syncfusion.Maui.Data

Enums

Xamarin SfDataGrid .NET MAUI SfDataGrid Description

ColumnSizer

ColumnWidthMode

Defines constants that specify how the columns in a

SfDataGrid

are sized.

SortTapAction

DataGridSortingGestureType

Defines the constants that specifies how the sorting is applied.

Properties

Xamarin SfDataGrid .NET MAUI SfDataGrid Description

AutoGenerateColumns

AutoGenerateColumnsMode.None

Defines constants that specify how the columns in a

SfDataGrid

are sized.

AllowSorting

SortingMode.Single

Specifies that the single column alone can be sorted at a time.

AllowMultiSorting

SortingMode.Multiple

Specifies that the multiple columns can be sorted.

SortTapAction

SortingGestureType

Defines the constants that specifies how the sorting is applied.

IsHidden

Visible

Gets or sets a value indicating whether a column should be visible.

SelectedItem

SelectedRow

Gets or sets a row which is currently selected.

SelectedItems

SelectedRows

Gets or sets the collection of rows which are all selected.

CurrentItem

CurrentRow

Gets or sets a row which is currently navigated.

HeaderBackgroundColor

HeaderRowBackground

Gets or sets the background for the header row.

RowBackgroundColor

RowBackground

Gets or sets the background of the data rows.

RowForegroundColor

RowTextColor

Gets or sets the text color of the data row.

HeaderForegroundColor

HeaderRowTextColor

Gets or sets the text color of the header row.

GridCellBorderColor

GridLineColor

Gets or sets the color for the grid lines.

GridCellBorderWidth

GridLineStrokeThickness

Gets or sets the stroke thickness of the grid lines.

SelectionBackgroundColor

SelectionBackground

Gets or sets the background of the selected rows.

SelectionForegroundColor

SelectedRowTextColor

Gets or sets the text color of the selected rows.

ColumnSizer

ColumnWidthMode

Gets or sets the value that indicates how all the columns widths are determined.

FontAttribute

DataGridCell.FontAttributes

Gets or sets the font attributes.

HeaderFont

DataGridHeaderCell.FontFamily

Gets or sets the font family.

HeaderFontAttribute

DataGridHeaderCell.FontAttributes

Gets or sets the font attributes.

RecordFont

DataGridCell.FontFamily

Gets or sets the font family.

Events

Xamarin SfDataGrid .NET MAUI SfDataGrid Description

GridTapped

CellTapped

Occurs when the cell is tapped.

GridDoubleTapped

CellDoubleTapped

Occurs when the cell is tapped twice.

GridLongPressed

CellLongPress

Occurs when the cell is long pressed for particular period.

QueryRowStyle

- This event is not available in MAUI DataGrid. You can write the custom style for

DataGridRow

TargetType.
By writing the converter, you can achieve the requirement conditionally. Refer

Conditional Styling

UG documentation for more information.

QueryCellStyle

- This event is not available in MAUI DataGrid. You can write the custom style for

DataGridCell

TargetType.
By writing the converter, you can achieve the requirement conditionally. Refer

Conditional Styling

UG documentation for more information.

Methods

Xamarin SfDataGrid .NET MAUI SfDataGrid Description

GetRowHeight

GetIntrinsicRowHeight

Gets the row height to fit that row based on the content.
We have passed the optional parameters such as

canIncludeHiddenColumns

and

excludedColumns

where as we have not provided the

GridRowSizingOptions

class as parameters.

Classes

Xamarin SfDataGrid .NET MAUI SfDataGrid Description

GridColumn

DataGridColumn

Represents the base class for the different column types of the

SfDataGrid

control.

GridNumericColumn

DataGridNumericColumn

A column which is used to handle the numeric values.

GridDateTimeColumn

DataGridDateColumn

A column which is used to show any type of System.DateTime.

GridImageColumn

DataGridImageColumn

A column which is used to show any type of ImageSource.

GridTemplateColumn

DataGridTemplateColumn

A column which is used to show any type of template.

GridTextColumn

DataGridTextColumn

Represents a

SfDataGrid

column that hosts textual Content in its cells.

GridCell

DataGridCell

Represents a record cell in a

SfDataGrid

control.

VirtualizingCellsControl

DataGridRow

Represents a record row in a

SfDataGrid

control.

GridHeaderCellControl

DataGridHeaderCell

Represents a header cell in a

SfDataGrid

control

GridColumnSizer

DataGridColumnSizer

Represents a class that handles the sizing for all the

columns

in the Columns collection in a

SfDataGrid

control.

Known issues

  • [Android] Horizontal scrolling performance is not smooth in the Debug solution configuration when compared to Xamarin.Forms SfDataGrid. However, the scrolling performance is smooth when the solution configuration is Release.

Upcoming Features

  • Paging
  • Right to left
  • Accessibility
  • Custom selection
  • Grouping
  • Summaries (Group and Caption)
  • Editing
  • ComboBox column
  • Load more
  • Swiping
  • Exporting to Excel and Pdf
  • Unbound row
  • Unbound column
  • Pull To Refresh
  • Column drag and drop
  • Row drag and drop