Migrate from Xamarin.Forms SfPicker to .NET MAUI SfPicker

6 Mar 20246 minutes to read

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

Namespaces

Xamarin SfPicker .NET MAUI SfPicker
Syncfusion.XForms.Pickers Syncfusion.Maui.Picker

Initialize control

To initialize the control, import the picker namespace and initialize SfPicker as shown in the following code sample.

Xamarin SfPicker .NET MAUI SfPicker
<ContentPage
    xmlns:picker="clr-namespace:Syncfusion.XForms.Pickers;assembly=Syncfusion.SfPicker.XForms">

        <picker:SfPicker />

    </ContentPage>
using Syncfusion.XForms.Pickers;
    ...

    SfPicker picker = new SfPicker();
    this.Content = picker;
<ContentPage
    xmlns:picker="clr-namespace:Syncfusion.Maui.Picker;assembly=Syncfusion.Maui.Picker">

        <picker:SfPicker />

    </ContentPage>
using Syncfusion.Maui.Picker;
    ...

    SfPicker picker = new SfPicker();
    this.Content = picker;

Classes

Xamarin SfPicker .NET MAUI SfPicker Description

SfPicker

SfPicker

The SfPicker class that represents a control, that allows you pick an item among a list of items.

PickerSelectionChangedEventArgs

PickerSelectionChangedEventArgs

Represents a class which is used to hold the selection changed event details.

Properties

SfPicker

The following code example, explains how to initialize the properties of the Xamarin SfPicker and .NET MAUI SfPicker class.

Xamarin SfPicker .NET MAUI SfPicker
<ContentPage
    xmlns:picker="clr-namespace:Syncfusion.XForms.Pickers;assembly=Syncfusion.SfPicker.XForms">

        <picker:SfPicker/>
        
    </ContentPage>
using Syncfusion.SfPicker.XForms;
    ...

    SfPicker picker = new SfPicker();
    this.Content = picker;
<ContentPage
    xmlns:picker="clr-namespace:Syncfusion.Maui.Picker;assembly=Syncfusion.Maui.Picker">

        <picker:SfPicker/>

    </ContentPage>
using Syncfusion.Maui.Picker;
    ..

    SfPicker picker = new SfPicker();
    this.Content = picker;
Xamarin SfPicker .NET MAUI SfPicker Description

BackgroundColor

Nil Not Supported.

BorderColor

Nil Not Supported.

CancelButtonBackgroundColor

[Background

Gets or sets the background of the footer view in SfPicker.

CancelButtonTextColor

TextColor From TextStyle of PickerFooterView

Gets or sets the text color of the text style.

ColumnHeaderBackgroundColor

Background

Gets or sets the background of the column header view in SfPicker.

ColumnHeaderFontAttributes

FontAttributes From TextStyle of PickerColumnHeaderView

Gets or sets the font attribute of the text style.

ColumnHeaderFontFamily

FontFamily From TextStyle of PickerColumnHeaderView

Gets or sets the font family of the text style.

ColumnHeaderFontSize

FontSize From TextStyle of PickerColumnHeaderView

Gets or sets the font size of the text style.

ColumnHeaderHeight

Height From PickerColumnHeaderView

Gets or sets the value to specify the height of column header view on SfPicker.

ColumnHeaderText

Text From PickerColumnHeaderView

Gets or sets the text color of the text style.

ColumnHeaderTextColor

TextColor From TextStyle of PickerColumnHeaderView

Gets or sets the text color of the text style.

DisplayMemberPath

DisplayMemberPath of PickerColumnHeaderView

Gets or sets the value to specify the path value for items source.

EnableLooping

Nil Not Supported.

FooterHeight

Height From PickerBase of FooterView

Gets or sets the value to specify the height of footer view on SfPicker.

FooterView

FooterView From PickerBase

Gets or sets the value of footer view. This property can be used to customize the of Footer in Picker.

HeaderBackgroundColor

[Background From HeaderView

Gets or sets the background of the header view in picker.

HeaderFontAttribute

FontAttribute From TextStyle of PickerHeaderView

Gets or sets the font attribute of the text style.

HeaderFontFamily

FontFamily From TextStyle of PickerHeaderView

Gets or sets the font family of the text style.

HeaderFontSize

FontSize From TextStyle of PickerHeaderView

Gets or sets the font size of the text style.

HeaderHeight

Height of PickerHeaderView

Gets or sets the value to specify the height of header view on picker.

HeaderText

HeaderText of PickerHeaderView

Gets or sets the value to specify the header text of the columns on SfPicker.

HeaderTextColor

TextColor From TextStyle of PickerHeaderView

Gets or sets the text color of the text style.

HeaderView

HeaderView

Gets or sets the value of header view. This property can be used to customize the of header in SfPicker.

IsOpen

IsOpen

Gets or sets a value indicating whether the picker is open or not.

ItemHeight

ItemHeight of PickerBase

Gets or sets the value to specify the height of picker view on Picker.

ItemsSource

ItemsSource of PickerColumn

Gets or sets the value to specify the text of columns on SfPicker.

ItemTemplate

ItemTemplate

Gets or sets the picker item template in SfPicker.

OKButtonBackgroundColor

Background of PickerBase From PickerFooterView

Gets or sets the background of the footer view in SfPicker.

OKButtonTextColor

TextColor From PickerTextStyle of TextStyle of PickerBase From PickerFooterView

Gets or sets the text color of the ok button of footer view in SfPicker.

Parent

Nil Not supported.

PickerHeight

Nil Not Supported.

PickerMode

Mode

Gets or sets the mode of the picker.

PickerWidth

Width From PickerColumn

Gets or sets the width of the column.

SelectedIndex

SelectedIndex From PickerColumn

Gets or sets the selected index of the columns on SfPicker.

SelectedItem

Nil Not Supported.

SelectedItemFontAttributes

FontAttributes From SelectedTextStyle

Gets or sets the font attribute of the text style.

SelectedItemFontFamily

FontFamily From SelectedTextStyle

Gets or sets the font family of the text style.

SelectedItemFontSize

FontSize From SelectedTextStyle

Gets or sets the font size of the text style.

SelectedItemTextColor

TextColor From SelectedTextStyle

Gets or sets the text color of the text style.

SelectionBackgroundColor

Background From PickerSelectionView

Gets or sets the background color of the selected item.

ShowColumnHeader

Nil Not Supported.

ShowFooter

Nil Not Supported.

ShowHeader

Nil Not Supported.

UnSelectedItemFontAttributes

FontAttributes From TextStyle

Gets or sets the font attribute of the text style.

UnSelectedItemFontFamily

FontFamily From TextStyle

Gets or sets the font family of the text style.

UnSelectedItemFontSize

FontSize From TextStyle

Gets or sets the font size of the text style.

UnSelectedItemTextColor

TextColor From TextStyle

Gets or sets the text color of the text style.

CommandParameter

Nil Not Supported.

OkCommand

Nil Not Supported.

CancelCommand

Nil Not Supported.

Events

Xamarin SfPicker .NET MAUI SfPicker Description

SelectionChanged

SelectionChanged

Occurs after the selected index changed on SfPicker.

Opened

Opened

Occurs whenever the opened on Picker.

Closed

Closed

Occurs whenever the closed on Picker.

Closing

Closing

Occurs whenever the closing on Picker.

OkButtonClicked

OkButtonClicked

Occurs whenever the footer ok button is clicked in Picker.

CancelButtonClicked

CancelButtonClicked

Occurs whenever the footer cancel button is clicked in Picker.

Known issues

  • Picker background color is not applied to the popup.
  • Picker dynamic items source does not render the picker item.

Upcomming features

  • Looping support for picker items.
  • SelectedItem support for picker.