Migrate from Xamarin.Forms SfTimePicker to .NET MAUI SfTimePicker

21 Aug 20246 minutes to read

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

Namespaces

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

Initialize control

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

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

    <timePicker:SfTimePicker />

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

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

    <timePicker:SfTimePicker />

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

SfTimePicker timePicker = new SfTimePicker();
this.Content = timePicker;

Classes

Xamarin SfTimePicker .NET MAUI SfTimePicker Description

PickerBase

PickerBase

Represents a base used to achieve the time picker custom view.

TimeChangedEventArgs

TimePickerSelectionChangedEventArgs

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

Properties

SfTimePicker

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

Xamarin SfTimePicker .NET MAUI SfTimePicker
<ContentPage
xmlns:timePicker="clr-namespace:Syncfusion.XForms.Pickers;assembly=Syncfusion.SfPicker.XForms">
    
    <timePicker:SfTimePicker Format="HH_mm_ss"/>

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

SfTimePicker timePicker = new SfTimePicker();
timePicker.Format = TimeFormat.HH_mm_ss;
this.Content = timePicker;
<ContentPage
xmlns:timePicker="clr-namespace:Syncfusion.Maui.Picker;assembly=Syncfusion.Maui.Picker">

    <timePicker:SfTimePicker Format="h_mm_ss_tt"/>

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

SfTimePicker timePicker = new SfTimePicker();
timePicker.Format = PickerTimeFormat.h_mm_ss_tt;
this.Content = timePicker;
Xamarin SfTimePicker .NET MAUI SfTimePicker Description

CancelCommand

DeclineCommand

Gets or sets a command to decline a selected time value of SfTimePicker.

CommandParameter

Nil Not Supported.

Format

Format

Gets or set the format that is used to change the format of SfTimePicker.

HeaderText

Text(From PickerHeaderView)

Gets or sets the header text to change the text of the header.

HourHeaderText

HourHeaderText(From TimePickerColumnHeaderView)

Gets or sets the hour header text to change the hour column header.

HourInterval

HourInterval

Gets or sets the hour interval to restrict the visible hours.

MeridiemHeaderText

MeridiemHeaderText(From TimePickerColumnHeaderView)

Gets or sets the meridiem header text to change the meridiem column header.

MinuteInterval

MinuteInterval

Gets or sets the minute interval to restrict the visible minutes.

MinutesHeaderText

MinuteHeaderText(From TimePickerColumnHeaderView)

Gets or sets the hour header text to change the hour column header.

OkCommand

AcceptCommand

Gets or sets a command to accept a selected time value of SfTimePicker.

SecondInterval

SecondInterval

Gets or sets the second interval to restrict the visible seconds.

SecondHeaderText

SecondHeaderText(From TimePickerColumnHeaderView)

Gets or sets the hour header text to change the hour column header.

Time

SelectedTime

Gets or sets the selected time to select the particular time of the time picker.

PickerBase

Xamarin SfTimePicker .NET MAUI SfTimePicker Description

BackgroundColor

Nil Not Supported.

BorderColor

Nil Not Supported.

CancelButtonBackgroundColor

BackgroundColor(From PickerFooterView)

Gets or sets the background color of the footer.

CancelButtonTextColor

TextColor(From TextStyle of PickerFooterView)

Gets or sets the text color of the text style.

ColumnHeaderBackgroundColor

BackgroundColor(From TimePickerColumnHeaderView)

Gets or sets the background color of the column header.

ColumnHeaderFontAttributes

FontAttributes(From TextStyle of TimePickerColumnHeaderView)

Gets or sets the font attribute of the column header text style.

ColumnHeaderFontFamily

FontFamily(From TextStyle of TimePickerColumnHeaderView)

Gets or sets the font family of the column header text style.

ColumnHeaderFontSize

FontSize(From TextStyle of TimePickerColumnHeaderView)

Gets or sets the font size of the column header text style.

ColumnHeaderHeight

Height(From TimePickerColumnHeaderView)

Gets or sets the height of the column header.

ColumnHeaderTextColor

TextColor(From TextStyle of TimePickerColumnHeaderView)

Gets or sets the text color of the column header text style.

EnableLooping

Nil Not Supported.

FooterHeight

Height(From PickerFooterView)

Gets or sets the height of the footer view.

FooterView

FooterView

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

HeaderBackgroundColor

BackgroundColor(From PickerHeaderView)

Gets or sets the background color of the header.

HeaderFontAttribute

FontAttribute(From TextStyle of PickerHeaderView)

Gets or sets the font attribute of the header text style.

HeaderFontFamily

FontFamily(From TextStyle of PickerHeaderView)

Gets or sets the font family of the header text style.

HeaderFontSize

FontSize(From TextStyle of PickerHeaderView)

Gets or sets the font size of the header text style.

HeaderHeight

Height(From PickerHeaderView)

Gets or sets the height of the header.

HeaderTextColor

TextColor(From TextStyle of PickerHeaderView)

Gets or sets the text color of the header text style.

HeaderView

HeaderView

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

IsOpen

IsOpen

Gets or sets the open to allow the dialog mode.

ItemHeight

ItemHeight

Gets or sets the item height of each item source.

OkButtonBackgroundColor

BackgroundColor(From PickerFooterView)

Gets or sets the background color of the footer.

OkButtonTextColor

TextColor(From TextStyle of PickerFooterView)

Gets or sets the text color of the text style.

PickerHeight

Nil Not Supported.

PickerWidth

Nil Not Supported.

SelectionBackgroundColor

BackgroundColor(From PickerSelectionView)

Gets or sets the background color of the selected item.

SelectedItemFontAttributes

FontAttributes(From SelectedTextStyle of PickerBase)

Gets or sets the font attribute of the selected text style.

SelectedItemFontFamily

FontFamily(From SelectedTextStyle of PickerBase)

Gets or sets the font family of the selected text style.

SelectedItemFontSize

FontSize(From SelectedTextStyle of PickerBase)

Gets or sets the font size of the selected text style.

SelectedItemTextColor

TextColor(From SelectedTextStyle of PickerBase)

Gets or sets the text color of the selected text style.

ShowColumnHeader

Nil Not Supported.

ShowFooter

Nil Not Supported.

ShowHeader

Nil Not Supported.

UnSelectedItemFontAttributes

FontAttributes(From TextStyle of PickerBase)

Gets or sets the font attributes of the unselected text style..

UnSelectedItemFontFamily

FontFamily(From TextStyle of PickerBase)

Gets or sets the font family of the unselected text style..

UnSelectedItemFontSize

FontSize(From TextStyle of PickerBase)

Gets or sets the font size of the unselected text style..

UnSelectedItemTextColor

TextColor(From TextStyle of PickerBase)

Gets or sets the text color of the unselected text style..

Enums

Xamarin SfTimePicker .NET MAUI SfTimePicker Description

TimeFormat

PickerTimeFormat

Defines the time format for the time picker.

PickerMode

PickerMode

Defines the mode of the time picker.

Events

Xamarin SfTimePicker .NET MAUI SfTimePicker Description

Opened

Opened

Occurs whenever the opened on the time picker.

Closed

Closed

Occurs whenever the closed on the time picker.

Closing

Closing

Occurs whenever the closing on the time picker.

TimeSelected

SelectionChanged

Occurs whenever the selection changed on the time picker.

OkButtonClicked

OkButtonClicked

Occurs whenever the footer ok button is clicked in the time picker.

CancelButtonClicked

CancelButtonClicked

Occurs whenever the footer cancel button is clicked in the time picker.

Upcoming Features

  • Enable looping support.