Migrate from Xamarin.Forms SfDataForm to .NET MAUI SfDataForm

16 Oct 202418 minutes to read

To make the migration from the Xamarin SfDataForm to the .NET MAUI SfDataForm easier, most of the APIs from the Xamarin SfDataForm were kept in the .NET MAUI SfDataForm. However, to maintain the consistency of API naming in the .NET MAUI SfDataForm, some of the APIs have been renamed. Please find the difference in the following topics.

Namespaces

Xamarin SfDataForm .NET MAUI SfDataForm
Syncfusion.SfDataForm.XForms Syncfusion.Maui.DataForm

Initialize control

To initialize the control, import the DataForm namespace and initialize the SfDataForm as shown in the following code sample.

Xamarin SfDataForm .NET MAUI SfDataForm
<ContentPage 
...
xmlns:dataForm="clr-namespace:Syncfusion.XForms.DataForm;assembly=Syncfusion.SfDataForm.XForms">
    <dataForm:SfDataForm x:Name="dataForm"/>
</ContentPage>
using Syncfusion.XForms.DataForm;
...

SfDataForm dataForm = new SfDataForm();
this.Content = dataForm;
<ContentPage
...
xmlns:dataForm="clr-namespace:Syncfusion.Maui.DataForm;assembly=Syncfusion.Maui.DataForm">
    <dataForm:SfDataForm x:Name="dataForm"/>
</ContentPage>
using Syncfusion.Maui.DataForm;


SfDataForm dataForm = new SfDataForm();
this.Content = dataForm;

Classes

Xamarin SfDataForm .NET MAUI SfDataForm Description

AutoCompleteMode

DataFormTextSearchMode

Specifies the type of the text search mode in ComboBox and AutoComplete.

AutoGeneratingDataFormItemEventArgs

GenerateDataFormItemEventArgs

Provides data for GenerateDataFormItem event.

CommitMode

DataFormCommitMode

Defines the constants for CommitMode that specify when the value entered by the user should be saved to the data object.

ConverterAttribute

DataFormValueConverterAttribute

Specifies the converter for the data field to convert the value before reading and saving in DataForm.

DataFormAutoCompleteItem

DataFormAutoCompleteItem

Represents the class that encapsulates the layout and auto complete editor(SfAutoComplete) settings for the data field.

DataFormCheckBoxItem

DataFormCheckBoxItem

Represents the class that encapsulates the layout and CheckBox editor settings for the data field.

DataFormDateItem

DataFormDateItem

Represents the class that encapsulates the layout and date picker editor settings for a data field.

DataFormDropDownItem

DataFormComboBoxItem

Represents the class that encapsulates the layout and ComboBox editor settings for the data field.

DataFormGroupItem

DataFormGroupItem

Represents the class to encapsulate the group settings for a group of data fields appearing in DataForm.

DataFormItem

DataFormItem

Represents the class that encapsulates the layout and editor setting for a data field appearing in DataForm.

DataFormItemBase

DataFormViewItem

Represents the base class that encapsulates the layout, group and editor setting for a data fields appearing in DataForm.

DataFormPickerItem

DataFormPickerItem

Represents the class that encapsulates the layout and picker editor settings for data field.

DataFormRadioGroupItem

DataFormRadioGroupItem

Represents the class that encapsulates the layout and RadioGroup editor settings for data field.

DataFormTextItem

DataFormTextItem

Represents the class that encapsulates the layout and text editor setting for a data field.

DataFormNumericItem

DataFormNumericItem

Represent the class that encapsulates the layout and numeric editor(SfNumericEntry) settings for data field.

DataFormMaskedEditTextItem

DataFormMaskedTextItem

Represent the class that encapsulates the layout and masked text editor(SfMaskedEntry) settings for data field.

DataFormTimeItem

DataFormTimeItem

Represents the class that encapsulates the layout and time picker editor setting for a data field.

DateRangeAttribute

DataFormDateRangeAttribute

Specifies the date range constraints for the value of a data field.

DisplayOptionsAttribute

DataFormDisplayOptionsAttribute

Provides a attribute that lets you specify the display settings for a data field.

LabelPosition

DataFormLabelPosition

Defines the constants for label position that specifies whether to layout the label at left or top of editor.

SfDataForm

SfDataForm

The DataForm control is used to manage data and develop various forms such as login, reservation, data entry, and so on.

SourceProvider

IDataFormSourceProvider

Represents the interface to provide a method to get the source for the picker type properties.

LabelStyle

DataFormTextStyle

Gets or sets properties which allows to customize the editor text style in the data form.

ValidatingEventArgs

DataFormValidateFormEventArgs

Provides data for ValidateForm event.

ValidationMode

DataFormValidationMode

Defines the constants for the ValidationMode that specifies when the user input should be validated for the data object.

TextInputLayoutSettings

TextInputLayoutSettings

Represents the class to settings for layout type to TextInputLayout.

Properties

SfDataForm

<ContentPage 
...
xmlns:dataForm="clr-namespace:Syncfusion.Maui.DataForm;assembly=Syncfusion.Maui.DataForm">
    <dataForm:SfDataForm x:Name="dataForm"
                        DataObject="{Binding DataModel}"
                        ColumnCount="2"/>
</ContentPage>
using Syncfusion.Maui.DataForm;
...

SfDataForm dataForm = new SfDataForm();
dataForm.DataObject = new DataModel();
dataForm.ColumnCount = 2;
this.Content = dataForm;
public class DataModel
{
    public string Name { get; set; }

    public string Email { get; set; }

    public int PhoneNumber { get; set; }

    public string Address { get; set; }
}
Xamarin SfDataForm .NET MAUI SfDataForm Description

DataObject

DataObject

Gets or sets the value which is used to set the editors to the data form.

IsReadOnly

IsReadOnly

Gets or sets a value indicating whether editors are enabled for editing.

CommitMode

CommitMode

Gets or sets the value that determines when to commit values that users enter in the data form’s editors to the bound data object.

ValidationMode

ValidationMode

Gets or sets a value that denotes when the user input should be validated based on IDataErrorInfo and ValidationAttributes.

Items

Items

Gets or sets the value which used to set the DataFormViewItem collection in the SfDataForm.

ColumnCount

ColumnCount

Gets or sets the value representing the number of editors to be arranged per row in the data form.

SourceProvider

ItemsSourceProvider

Gets or sets the value to get the source for the picker type editors.

AutoGenerateItems

AutoGenerateItems

Gets or sets a value indicating whether to auto-generate the DataFormItems in the data form.

ItemManager

ItemManager

Get or set the item manager.
Nil

EditorTextStyle

Gets or sets the style of the editor text used to customize the text color, font, font size, font family, and font attributes.
Nil

LabelTextStyle

Gets or sets the label text style used to customize the text color, font, font size, font family, and font attributes.
Nil

ErrorLabelTextStyle

Gets or sets the style of error label text used to customize the text color, font, font size, font family, and font attributes.
Nil

ValidMessageLabelTextStyle

Gets or sets the style of the validation label text used to customize the text color, font size, font family, and font attributes.
Nil

DefaultLayoutSettings

Gets or sets the settings to customize the default layout (Holds label and editor) settings.

LayoutOptions

LayoutType

Gets or sets the layout options for DataForm to define the layout type for the Dataform.
Nil

TextInputLayoutSettings

Gets or sets the floating label layout settings for Dataform.

DataFormTextStyle

The properties of the Xamarin SfDataForm LabelStyle are grouped to the DataFormTextStyle in .NET MAUI SfDataForm.

<ContentPage
...
xmlns:DataForm="clr-namespace:Syncfusion.Maui.DataForm;assembly=Syncfusion.Maui.DataForm">
<dataForm:SfDataForm
        x:Name="dataForm">
        <dataForm:SfDataForm.LabelTextStyle>
            <dataForm:DataFormTextStyle
                TextColor="Red"
                FontAttributes="Italic"
                FontSize="12">                
            </dataForm:DataFormTextStyle>
        </dataForm:SfDataForm.LabelTextStyle>
    </dataForm:SfDataForm>
</ContentPage>
using Syncfusion.Maui.DataForm;


SfDataForm dataForm = new SfDataForm();
this.dataForm.DataObject = new DataModel();
this.dataForm.LabelTextStyle = new DataFormTextStyle()
{
    TextColor = Colors.Red,
    FontAttributes = FontAttributes.Italic,
    FontSize = 12,
};
this.Content = dataForm;
public class DataModel
{
    public string Name { get; set; }

    public string Email { get; set; }

    public int PhoneNumber { get; set; }

    public string Address { get; set; }
}
Xamarin SfDataForm .NET MAUI SfDataForm Description
Nil

TextColor

Gets or sets the editor text color in the data form.

FontSize

FontSize

Gets or sets the double value that represents the text font size in the data form.

FontFamily

FontFamily

Gets or sets the string that represents the text font family in the data form.

FontAttributes

FontAttributes

Gets or sets the text font attributes in the data form.

DataFormViewItem

Xamarin SfDataForm .NET MAUI SfDataForm Description

RowSpan

RowSpan

Gets or sets the number of rows this item spans, which increases the item's height.

ColumnSpan

ColumnSpan

Gets or sets the number of columns this item spans to increase the item's width.

IsVisible

IsVisible

Gets or sets a value indicating whether the data form item layout (Holds editor and label) is visible or not.
Nil

RowOrder

Gets or sets the row order of the editor in the data form.
Nil

Padding

Gets or sets the space between the data form item’s editor and label.

DataFormItem

Xamarin SfDataForm .NET MAUI SfDataForm Description

GroupName

GroupName

Gets or sets the name of the group to the editor.

Name

FieldName

Gets or sets the editor's name in the data form.

LabelText

LabelText

Gets or sets the editor’s label text.

PlaceHolderText

PlaceholderText

Gets or sets the prompt string displayed or the water mark to provide hint for users in the editors.
Nil

PlaceholderColor

Gets or sets the color of the prompt string displayed or the watermark to provide hints for users in the editors.

ShowLabel

ShowLabel

Gets or sets a value indicating whether to show the label to the editor.

IsReadOnly

IsReadOnly

Gets or sets a value indicating whether the editor can be enabled or disabled.

EditorFontSize

EditorTextStyle

Gets or sets the style of editor text used to customize the text color, font, font size, font family, and font attributes.

ErrorMessageColor

ErrorLabelTextStyle

Gets or sets the style of the error message label used to customize the text color, font, font size, font family, and font attributes.

ValidationLabelStyle

ValidMessageLabelTextStyle

Gets or sets the style of a valid message label used to customize the text color, font size, font family, and font attributes.
Nil

LabelTextStyle

Gets or sets the style of editor label text used to customize the text color, font size, font family, and font attributes.
Nil

Background

Gets or sets the background to the data form item layout, which is used to render the label and editor for the data field.
Nil

DefaultLayoutSettings

Gets or sets the value of the layout (holds label and editor) settings used to customize the label position, label width, and editor width.
Nil

ItemsOrderInRow

Gets or sets the editor’s position in a row.

ImageSource

LeadingView

Gets or sets an image used as the editor’s label.

IsValid

IsValid

Gets a value indicating whether this DataFormItem is valid or not.

PropertyInfo

PropertyInfo

Gets the property info of the data field.

LayoutOptions

LayoutType

Gets or sets the layout options for DataFormItem to define the layout type for the DataFormItem in dataform.

TextInputLayoutSettings

TextInputLayoutSettings

Gets or sets the Text input Layout Settings for dataformitem to customize and configure the text input layout item in dataform.
Nil

ShowLeadingView

Nil

LeadingViewPosition

Gets or sets the value that determines whether to place the leading view within the floating label layout.
Nil

TrailingView

Gets or sets a value for a view to place after input view.
Nil

TrailingViewPosition

Gets or sets a value that determines whether to place the trailing view within the layout.
Nil

ShowTrailingView

Gets or sets a value that indicates whether to display the trailing view.

Height

EditorHeight

Gets or sets the height of the editor.

DataFormDefaultLayoutSettings

The following properties of the Xamarin SfDataForm is moved to the DataFormDefaultLayoutSettings class of .NET MAUI SfDataForm.

Xamarin SfDataForm .NET MAUI SfDataForm Description

LabelPosition

LabelPosition

Gets or sets the label position for DataFormItem to define the position of the label associated with the editor.

LabelWidth

LabelWidth

Gets or sets the width of the label.

EditorWidth

EditorWidth

Gets or sets the width of the editor.

TextInputLayoutSettings

Xamarin SfDataForm .NET MAUI SfDataForm Description

ContainerType

ContainerType

Gets or sets a value determining the container types for floating label layout.

OutlineCornerRadius

OutlineCornerRadius

Gets or sets a value to customize the customize the corner radius of outline border in the floating label layout.
Nil

EnableFloating

Gets or sets a value that indicates whether to float the label when it is focused or unfocused.
Nil

IsHintAlwaysFloated

Gets or sets a value that indicates whether to fix the hint label always at the top even when the text is empty in the floating label layout.
Nil

EnableHintAnimation

Gets or sets a value that indicates whether to enable animation for the hint text when the input view is focused or unfocused in the floating label layout.
Nil

HelperTextStyle

Gets or sets the style for helper label in the floating label layout.
Nil

Stroke

Gets or sets the border color based on the container in the floating label layout.
Nil

FocussedStrokeThickness

Gets or sets as a value to customize the stroke width in a focused state in the floating label layout. It applies to the bottom line and outline border when setting the container type as filled and outlined.
Nil

UnfocussedStrokeThickness

Gets or sets as a value to customize the stroke width in an unfocused state in the floating label layout. It applies to the bottom line and outline border when setting the container type as filled and outlined.

ShowHelperText

ShowHelperText

Gets or sets a value indicating whether to display the helper and error text. It determines the visibility of the helper text and error text.
Nil

FocusedStroke

Gets or sets the focused border color or focused baseline color based on the container type of the data form floating label layout type.

DataFormGroupItem

Xamarin SfDataForm .NET MAUI SfDataForm Description

ColumnCount

ColumnCount

Gets or sets the value representing the number of editors to be arranged per row in the DataFormGroupItem.

DataFormItems

Items

Gets or sets the value which used to set the items grouped under the group.

IsExpanded

IsExpanded

Gets or sets a value indicating whether the group of editors is expanded or not.

AllowExpandCollapse

AllowExpandCollapse

Gets or sets a value indicating whether users can collapse and expand the group of editors.
Nil

HeaderTextStyle

Gets or sets the style of group header text, that used to customize the text color, font, font size, font family and font attributes.
Nil

HeaderBackground

Gets or sets the background color for the header of the editor group.
Nil

ItemsPadding

Gets or sets the distance between editors and the data form’s borders or group headers.

GroupName

Name

Gets or sets the name of the editor group.

DataFormPasswordItem

Xamarin SfDataForm .NET MAUI SfDataForm Description

EnablePasswordVisibilityToggle

EnablePasswordVisibilityToggle

Gets or sets a value that indicates whether to show the password visibility toggle.

DataFormCheckBoxItem

Xamarin SfDataForm .NET MAUI SfDataForm Description

CheckedColor

Color

Gets or sets the color of CheckBox editor.

DataFormSwitchItem

Xamarin SfDataForm .NET MAUI SfDataForm Description
Nil

OnColor

Gets or sets the color of the switch when it is in the on state.
Nil

ThumbColor

Gets or sets the thumb color of the switch editor.

DataFormTextEditorItem

Xamarin SfDataForm .NET MAUI SfDataForm Description

KeyBoard

Keyboard

Gets or sets the type of keyboard used to display the text, multiline, and password editor.

DataFormNumericItem

Xamarin SfDataForm .NET MAUI SfDataForm Description

AllowNull

AllowNull

Get or set a value indicating whether the DataFormNumericEditor allows a null value or not.

FormatString

CustomFormat

Get or set the format used to specify the formatting of the editor value.

Maximum

Maximum

Get or set the numerical maximum value for DataFormNumericEditor.

Minimum

Minimum

Get or set the numerical minimum value for DataFormNumericEditor.

CultureInfo

Culture

Get or set the culture for DataFormNumericEditor.

DataFormMaskedTextItem

Xamarin SfDataForm .NET MAUI SfDataForm Description

CultureInfo

Culture

Get or set the culture for mask values based on the given culture.

Mask

Mask

Get or set the mask value which restricts the inputs provided in the control.

MaskType

MaskType

Get or set the mask type for the DataFormMaskedTextEditor.

PromptChar

PromptChar

Get or set a char which is used as a prompt char of DataFormMaskedTextEditor.

ValueMaskFormat

ValueMaskFormat

Get or set the format for the value.

DataFormDateItem

Xamarin SfDataForm .NET MAUI SfDataForm Description

Format

Format

Gets or sets the time format for time picker.

MaximumDate

MaximumDisplayDate

Gets or sets the maximum display date to restrict the visible dates of the date editor.

MinimumDate

MinimumDisplayDate

Gets or sets the minimum display date to restrict the visible dates of the date editor.

DataFormTimeItem

Xamarin SfDataForm .NET MAUI SfDataForm Description

Format

Format

Gets or sets the time format for the Time Picker.

DataFormListItem

The common properties of Xamarin SfDataForm list items ( DataFormPickerEditor, DataFormAutoCompleteEditor, DataFormDropDownEditor and DataFormRadioGroupEditor) are added to the DataFormListItem class in the .NET MAUI SfDataForm.

Xamarin SfDataForm .NET MAUI SfDataForm Description

ItemsSource

ItemsSource

Gets or sets the collection, which will be displayed in the picker where the user can select from available items.

DisplayMemberPath

DisplayMemberPath

Gets or sets a path to a value on the source object that will get displayed in the picker.

ValueMemberPath

SelectedValuePath

Gets or sets a path to a value on the source object which will get saved to the data field.

DataFormComboBoxItem

Xamarin SfDataForm .NET MAUI SfDataForm Description
Nil

IsEditable

Gets or sets a value indicating whether the ComboBox can be edited.
Nil

TextSearchMode

Gets or sets the text search mode for the ComboBox editor.

DataFormAutoCompleteItem

Xamarin SfDataForm .NET MAUI SfDataForm Description

AutoCompleteMode

TextSearchMode

Gets or sets the text search mode for the auto complete editor.

DataFormDisplayOptionsAttribute

Xamarin SfDataForm .NET MAUI SfDataForm Description

ColumnSpan

ColumnSpan

Gets or sets the number of columns this item spans to increase the item's width.

RowSpan

RowSpan

Gets or sets the number of rows this item spans, which is used to increase the item's height.
Nil

RowOrder

Gets or sets the row order of the editor in the data form.
Nil

ItemsOrderInRow

Gets or sets the editor’s position in a row.

ShowLabel

ShowLabel

Gets or sets a value indicating whether to show the label to the DataForm editor.

ValidMessage

ValidMessage

Gets or sets a string displayed when the user enters a valid value for the data field as a success message.

DataFormDateRangeAttribute

Xamarin SfDataForm .NET MAUI SfDataForm Description

MinDay

MinimumDate

Gets or sets the minimum date that users can assign to the date editor.

MaxDay

MaximumDate

Gets or sets the maximum date that users can assign to the date editor.

MinMonth

Nil Gets or sets the minimum month of a date.

MaxMonth

Nil Gets or sets the maximum month of a date.

MinYear

Nil Gets or sets the minimum year of a date.

MaxYear

Nil Gets or sets the maximum year of a date.
Nil

DisplayFormat

Gets or sets the attribute date display format of the date editor.

DataFormValueConverterAttribute

Xamarin SfDataForm .NET MAUI SfDataForm Description

ConverterType

ConverterType

Gets the Converter type.

Enums

Xamarin SfDataForm .NET MAUI SfDataForm Description

CommitMode

DataFormCommitMode

Defines the constants for the CommitMode that specify when the value entered by the user should be saved to the data object.

LabelPosition

DataFormLabelPosition

Defines the constants for the label position that specifies whether to lay out the label at the left or top of the editor.

SuggestionMode

DataFormTextSearchMode

Specifies the type of the text search mode in ComboBox and AutoComplete.

ValidationMode

DataFormValidationMode

Defines the constants for the ValidationMode that specifies when the user input should be validated for the data object.

LayoutType

DataFormLayoutType

Defines the constants for the ValidationMode that specifies when the user input should be validated for the data object.

ContainerType

TextInputLayoutContainerType

Defines the constants for the ValidationMode that specifies when the user input should be validated for the data object.

ViewPosition

TextInputLayoutViewPosition

Defines the constants for the ValidationMode that specifies when the user input should be validated for the data object.

MaskType

MaskedEditorMaskType

Defines the constants for DataFormMaskedTextItem MaskType

MaskFormat

MaskedEditorMaskFormat

Defines the constants for DataFormMaskedTextItem ValueMaskFormat.
Nil

MaskedEditorClearButtonVisibility

Defines the constants for ClearButtonVisibility that specifies when to show clear button.

SpinButtonAlignment

NumericEditorUpDownPlacementMode

Defines the constants for ClearButtonVisibility that specifies when to show clear button.

Events

Xamarin SfDataForm .NET MAUI SfDataForm Description

AutoGeneratingDataFormItem

GenerateDataFormItem

Occurs during the generation of data form item in the data form when AutoGenerateItems is true.

Validating

ValidateProperty

Occurs when SfDataForm validates the user input.

ValidationCompleted

ValidateForm

Occurs when DataFormValidationMode is Manual to get the invalid DataFormItem’s details.

Methods

Xamarin SfDataForm .NET MAUI SfDataForm Description

RegisterEditor

RegisterEditor

Method to register DataFormEditor.

Validate

Validate

Validates all the fields of DataFormViewItem

Commit

Commit

Method to commit all properties underlying data object from the editor view.

UpdateEditor

UpdateEditor

Updates the value of the specific property in corresponding editor.

Known issues in .NET MAUI DataForm

  • [MacCatalyst] - TimePicker popup is not working.
  • [MacCatalyst, iOS] - Multiline editor placeholder text font size not changing based on editor font size.
  • [MacCatalyst, iOS] – Date and Time picker text styles are not changing.
  • [MacCatalyst, iOS] – Date picker minimum and maximum display dates are not working.
  • [MacCatalyst, iOS] - Text style not applied to radio button.
  • [Android, iOS, MacCatalyst] - In RTL mode, the multiline text editor text is not showing from the right.
  • [Windows] - Picker editor text style is not changing.
  • [iOS] - Maximum input length is not working in Text and Password editors.
  • [Windows] - Time picker format not changing.
  • [MacCatalyst, iOS] - RTL FlowDirection is not working for Date and Time pickers.
  • [MacCatalyst, iOS] - In RTL FlowDirection, the ScrollView scroll bar shows at the right.
  • [Android] - in RTL mode Radio button’s content does not arrange from the right.
  • RTL flow direction not working for ComboBox and AutoComplete editors.
  • IsReadOnly not working for AutoComplete editor.
  • Dark and light theme - There is no border and focused border stroke customization for the default editors (Text, password, multiline text, picker, DatePicker, and TimePicker).
  • Dark and light theme - [iOS] There is no border and focused border stroke customization for the default editor (Text, password, picker, DatePicker, and TimePicker).
  • Dark and light theme -[MacOS] There is no border and focused border stroke customization for the default editor (Text, password, and picker).
  • Dark and light theme - MacOS The text color customization will not work for the DatePicker and TimePicker.