Migrate from Xamarin.Forms SfCalendar to .NET MAUI SfCalendar

21 Aug 202414 minutes to read

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

Namespaces

Xamarin SfCalendar .NET MAUI SfCalendar
Syncfusion.SfCalendar.XForms Syncfusion.Maui.Calendar

NOTE

The selection-based .NET MAUI SfCalendar does not manage appointments like the Xamarin SfCalendar does. If you require appointment/events management use .NET MAUI SfScheduler.

Initialize control

To initialize the control, import the calendar namespace and initialize SfCalendar as shown in the following code sample.

Xamarin SfCalendar .NET MAUI SfCalendar
<ContentPage
xmlns:calendar="clr-namespace:Syncfusion.SfCalendar.XForms;assembly=Syncfusion.SfCalendar.XForms">

    <calendar:SfCalendar/>

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

SfCalendar calendar = new SfCalendar ();
this.Content = calendar;
<ContentPage
xmlns:calendar="clr-namespace:Syncfusion.Maui.Calendar;assembly=Syncfusion.Maui.Calendar">

    <calendar:SfCalendar />

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

SfCalendar calendar = new SfCalendar();
this.Content = calendar;

Classes

Xamarin SfCalendar .NET MAUI SfCalendar Description

SelectionRange

CalendarDateRange

Represents a class which holds the start and end date of the range in SfCalendar.

MonthViewSettings

CalendarMonthView

Represents a class which is used to configure all the properties and styles of calendar month view.

YearViewSettings

CalendarYearView

Represents a class which is used to used to configure all the properties and styles of calendar year, decade and century view.

CalendarTappedEventArgs

CalendarTappedEventArgs

Represents a class which is used to hold the tap interaction event details and it occurs when the user clicks or touch on the calendar elements.

DayCellHoldingEventArgs

CalendarLongPressedEventArgs

Represents a class which is used to hold the long press interaction event details and it occurs when the user long press inside the calendar elements.

MonthChangedEventArgs

CalendarViewChangedEventArgs

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

SelectionChangedEventArgs

CalendarSelectionChangedEventArgs

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

ViewModeChangedEventArgs

CalendarViewChangedEventArgs

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

MonthLabelSettings

Nil Use properties from

MonthView

.

CalendarInlineEvent

Nil Not Supported.

MonthEventParameters

Nil Not Supported.

InlineEventArgs

Nil Not Supported.

InlineItemTappedEventArgs

Nil Not Supported.

InlineToggledEventArgs

Nil Not Supported.

MonthCell

Nil Use properties from

MonthView

MonthCellLoadedEventArgs

Nil Use the

ViewChanged

event args.

MonthChangingEventArgs

Nil Not Supported.

YearCell

Nil Use properties from

YearView

YearCellLoadedEventArgs

Nil Use the

ViewChanged

event args.

Properties

SfCalendar

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

Xamarin SfCalendar .NET MAUI SfCalendar
<ContentPage
xmlns:calendar="clr-namespace:Syncfusion.SfCalendar.XForms;assembly=Syncfusion.SfCalendar.XForms">

    <calendar:SfCalendar ViewMode="MonthView"/>

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

SfCalendar calendar = new SfCalendar ();
calendar.ViewMode = CalendarView.MonthView;
this.Content = calendar;
<ContentPage
xmlns:calendar="clr-namespace:Syncfusion.Maui.Calendar;assembly=Syncfusion.Maui.Calendar">

    <calendar:SfCalendar View="Month"/>

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

SfCalendar calendar = new SfCalendar();
calendar.View = CalendarView.Month;
this.Content = calendar;
Xamarin SfCalendar .NET MAUI SfCalendar Description

AgendaViewHeight

Nil For agenda view related support use the .NET MAUI Scheduler control.

BlackoutDates

SelectableDayPredicate

Gets or sets the function to decide whether the cell is selectable or not in the calendar.

BlackoutDatesViewMode

Nil Use the

SelectableDayPredicate

for this requirement.

CustomDayLabels

Nil By using custom header (hides default view header using

Height

value as 0), you can customize.

DataSource

Nil For

Datasource

related support suggesting to use .NET MAUI Scheduler

DisplayDate

DisplayDate

Gets or sets the display date to programmatically navigate the dates in the SfCalendar.

EnableDatesInPast

EnablePastDates

Gets or sets a value indicating whether the dates enabled or disabled before today date.

EnableSwiping

EnableSwipeSelection

Gets or sets a value indicating whether the swiping selection enabled for select the date range.

FirstDayofWeek

[FirstDayOfWeek(From MonthView)]

Gets or sets the day of week that used to change the default first day of week in SfCalendar.

HeaderHeight

[Height(From HeaderView)]

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

HeaderView

CalendarHeaderView

Represents a class which is used to customize all the properties of header view of the SfCalendar.

HoldCommand

LongPressedCommand

Gets or sets a command to hold a date of SfCalendar.

InlineViewMode

Nil Not Supported.

Locale

Nil Refer to this [link](https://help.syncfusion.com/maui/calendar/localization) for using localization in .NET MAUI Calendar

MaxDate

MaximumDate

Gets or sets the maximum display date to restrict the visible dates in the SfCalendar.

MaximumEventIndicatorCount

Nil For

Datasource

related support suggesting to use .NET MAUI Scheduler

MinDate

MinimumDate

Gets or sets the minimum display date to restrict the visible dates in the SfCalendar.

MonthChangedCommand

ViewChangedCommand

Gets or sets a command to change the view of SfCalendar.

MonthViewSettings

MonthView

Gets or sets the properties which allows to customize the calendar month view.

MoveToDate

DisplayDate

Gets or sets the display date to programmatically navigate the dates in the SfCalendar.

NavigateToMonthOnInActiveDatesSelection

Nil It can be achieved by setting the

DisplayDate

property inside the

Tapped

event.

NavigationArrowThickness

Nil By using custom header (

Height

value as 0), customize the navigation arrows.

NavigationButtonHeight

Nil By using custom header, customize the navigation arrows.

NavigationButtonWidth

Nil By using custom header, customize the navigation arrows.

NavigationDirection

NavigationDirection

Gets or sets a value which determines the direction of the calendar scrolls.

NullableSelectedDate

SelectedDate

Gets or sets the selected date to select the particular date of the calendar.

NumberOfWeeksInView

[NumberOfVisibleWeeks(From MonthView)]

Gets or sets a value to display the number of weeks in calendar month view.

SelectedDate

SelectedDate

Gets or sets the selected date to select the particular date of the calendar.

SelectedDates

SelectedDates

Gets or sets the selected dates to select the multiple dates of the calendar.

SelectedRange

SelectedDateRange

Gets or sets the selected date range to select the range of dates of the calendar.

SelectionChangedCommand

SelectionChangedCommand

Gets or sets a command to select a date of SfCalendar.

SelectionMode

SelectionMode

Gets or sets the selection mode of the calendar.

ShowHeader

Nil By using

Height

value as 0 in the HeaderView, you can hide and show the headers.

ShowInlineEvents

Nil Not Supported.

ShowLeadingAndTrailingDays

ShowTrailingAndLeadingDates

Gets or sets a value indicating whether to displays the leading and trailing dates in the month, decade, century views of the SfCalendar.

ShowNavigationButtons

[ShowNavigationArrows(From HeaderView)]

Gets or sets a value indicating whether to displays the navigation arrows on the header view of the SfCalendar.

ShowYearView

AllowViewNavigation

Gets or sets a value indicating whether the navigation enabled on year, decade and century cell interaction.

TapCommand

TappedCommand

Gets or sets a command to tap a date of SfCalendar.

ToggleDaySelection

CanToggleDaySelection

Gets or sets a value indicating whether the selected date is deselect through interaction on single selection mode of SfCalendar.

TransitionMode

Nil Not Supported.

ViewMode

View

Gets or sets the built-in views such as month, year, decade and century of the SfCalendar.

VisibleDates

Nil Use visible dates from the

ViewChanged

event.

YearViewMode

Nil Not Supported.

YearViewSettings

YearView

Gets or sets the properties which allows to customize the calendar year, decade and century views.

MonthViewSettings

The following code example explains how to configure the month view settings in Xamarin SfCalendar and .NET MAUI SfCalendar.

Xamarin SfCalendar .NET MAUI SfCalendar
<ContentPage
xmlns:calendar="clr-namespace:Syncfusion.SfCalendar.XForms;assembly=Syncfusion.SfCalendar.XForms">
        <calendar:SfCalendar x:Name="calendar">
            <calendar:SfCalendar.MonthViewSettings>
                <calendar:MonthViewSettings SelectionShape = SelectionShape.Circle/>
            </calendar:SfCalendar.MonthViewSettings>
        </calendar:SfCalendar>

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

SfCalendar calendar = new SfCalendar ();
calendar.MonthViewSettings.SelectionShape = SelectionShape.Circle;
this.Content = calendar;
<ContentPage
xmlns:calendar="clr-namespace:Syncfusion.Maui.Calendar;assembly=Syncfusion.Maui.Calendar">
        <calendar:SfCalendar x:Name="calendar">
            <calendar:SfCalendar.MonthView>
                <calendar:CalendarMonthView NumberOfVisibleWeeks="6"/>
            </calendar:SfCalendar.MonthView>
        </calendar:SfCalendar>

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

SfCalendar calendar = new SfCalendar();
calendar.MonthView.NumberOfVisibleWeeks = 6;
this.Content = calendar;
Xamarin SfCalendar .NET MAUI SfCalendar Description

AgendaSelectedDateColor

Nil Not Supported.

BlackoutColor

DisabledDatesTextStyle

Gets or sets the text style of the disabled month cells text, that used to customize the text color, font, font size, font family and font attributes.

BorderColor

Nil Using the

CellTemplate

, you can customize the month cells.

CellGridOptions

Nil Using the

CellTemplate

, you can customize the month cells.

CellTemplate

CellTemplate

Gets or sets the month cell template or template selector.

CurrentMonthBackgroundColor

Background

Gets or sets the background for the month cells of the calendar month view.

CurrentMonthTextColor

[TextColor(From TextStyle of MonthView)]

Gets or sets the text color of the text style.

DateSelectionColor

SelectionBackground

Gets or sets the value that describes the highlight of selection based on selection mode of the calendar.

DateTextAlignment

Nil Using the

CellTemplate

, you can align the month cells text.

DayCellFont

Nil Not Supported.

DayCellFontFamily

[FontFamily(From TextStyle, TodayTextStyle, TrailingLeadingDatesTextStyle, DisabledDatesTextStyle, WeekendDatesTextStyle, SpecialDatesTextStyle of MonthView)]

Gets or sets the font family of the text style.

DayFontSize

[FontSize(From TextStyle, TodayTextStyle, TrailingLeadingDatesTextStyle, DisabledDatesTextStyle, WeekendDatesTextStyle, SpecialDatesTextStyle of MonthView)]

Gets or sets the font size of the text style.

DayFontAttributes

[FontAttributes(From TextStyle, TodayTextStyle, TrailingLeadingDatesTextStyle, DisabledDatesTextStyle, WeekendDatesTextStyle, SpecialDatesTextStyle of MonthView)]

Gets or sets the font attributes of the text style.

DayHeaderBackgroundColor

[Background(From HeaderView of MonthView)]

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

DayHeaderFont

Nil Not Supported.

DayHeaderFontAttributes

[FontAttributes(From TextStyle of HeaderView in MonthView)]

Gets or sets the font attributes of the text style.

DayHeaderFontFamily

FontFamily(From TextStyle of HeaderView in MonthView)

Gets or sets the font family of the text style.

DayHeaderFontSize

[FontSize(From TextStyle of HeaderView in MonthView)]

Gets or sets the font size of the text style.

DayHeaderTextColor

[TextColor(From TextStyle of HeaderView in MonthView)]

Gets or sets the text color of the text style.

DayHeaderFormat

[TextFormat(From HeaderView of MonthView)]

Gets or sets the font attributes of the text style.

DayHeight

[Height(From HeaderView of MonthView)]

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

DayLabelTextAlignment

Nil Using the

CellTemplate

, you can customize the month cells.

DisabledBackgroundColor

DisabledDatesBackground

Gets or sets the background for the disabled month cells of the calendar month view.

DisabledTextColor

[TextColor(From DisabledDatesTextStyle of MonthView)]

Gets or sets the text color of the text style.

HeaderBackgroundColor

[Background(From HeaderView of SfCalendar)]

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

HeaderFont

Nil Not Supported.

HeaderFontAttributes

[FontAttributes(From TextStyle of HeaderView in SfCalendar)]

Gets or sets the font attributes of the text style.

HeaderFontFamily

[FontFamily(From TextStyle of HeaderView in SfCalendar)]

Gets or sets the font family of the text style.

HeaderFontSize

[FontSize(From TextStyle of HeaderView in SfCalendar)]

Gets or sets the font size of the text style.

HeaderTextColor

[TextColor(From TextStyle of HeaderView in SfCalendar)]

Gets or sets the text color of the text style.

InlineBackgroundColor

Nil Not Supported.

InlineItemTemplate

Nil Not Supported.

InlineTextColor

Nil Not Supported.

MonthLabelSettings

Nil Use properties from

MonthView

.

PreviousMonthBackgroundColor

YearTrailingLeadingDatesBackgroundView

Gets or sets the background for the trailing and leading month cells of the calendar month view.

PreviousMonthTextColor

TextColor(From TrailingLeadingDatesTextStyle)

Gets or sets the text color of the text style.

SelectedDayTextColor

[TextColor(From SelectionTextStyle and RangeTextStyle)]

Gets or sets the text color of the text style.

SelectionRadius

Nil Not Supported.

SelectionShape

[SelectionShape(From SfCalendar)]

Gets or sets the selection shape of the SfCalendar.

TodayBorderColor

[TodayHighlightBrush(From SfCalendar)]

Gets or sets the value that describes the today highlight color value.

TodaySelectionBackgroundColor

[SelectionBackground(From SfCalendar)]

Gets or sets the value that describes the highlight of selection based on selection mode of the calendar.

TodaySelectionTextColor

[TextColor(From SelectionTextStyle and RangeTextStyle)]

Gets or sets the text color of the text style.

TodayTextColor

TextColor(From TodayTextStyle)]

Gets or sets the text color of the text style.

WeekDayBackgroundColor

Background, TodayBackground, TrailingLeadingDatesBackground, DisabledDatesBackground, SpecialDatesBackground

Gets or sets the background for the week day month cells of the calendar month view.

WeekDayTextColor

[TextColor(From TextStyle, TodayTextStyle, TrailingLeadingDatesTextStyle, DisabledDatesTextStyle, SpecialDatesTextStyle)]

Gets or sets the text color of the text style.

WeekEndBackgroundColor

WeekendDatesBackground

Gets or sets the background for the weekend month cells of the calendar month view.

WeekEndTextColor

[TextColor(From WeekendDatesTextStyle)]

Gets or sets the text color of the text style.

YearViewSettings

The following code example explains how to configure the year view settings in Xamarin SfCalendar and .NET MAUI SfCalendar.

Xamarin SfCalendar .NET MAUI SfCalendar
<ContentPage
xmlns:calendar="clr-namespace:Syncfusion.SfCalendar.XForms;assembly=Syncfusion.SfCalendar.XForms">

<calendar:SfCalendar x:Name="calendar">
            <calendar:SfCalendar.YearViewSettings>
                <calendar:YearViewSettings HeaderBackground = "Red"/>
            </calendar:SfCalendar.YearViewSettings>
        </calendar:SfCalendar>

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

SfCalendar calendar = new SfCalendar ();
calendar.YearViewSettings.HeaderBackground = Colors.Red;
this.Content = calendar;
<ContentPage
xmlns:calendar="clr-namespace:Syncfusion.Maui.Calendar;assembly=Syncfusion.Maui.Calendar">
         <calendar:SfCalendar x:Name="calendar">
            <calendar:SfCalendar.YearView>
                <calendar:CalendarYearView Background="Red"/>
            </calendar:SfCalendar.YearView>
        </calendar:SfCalendar>

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

SfCalendar calendar = new SfCalendar();
calendar.YearView.Background = Colors.Red;
this.Content = calendar;
Xamarin SfCalendar .NET MAUI SfCalendar Description

LayoutBackground

Background

Gets or sets the background for the month cells of the calendar month view.

LabelAlignment

Nil Use the

CellTemplate

property from YearView.

MonthHeaderBackground

Nil Use the

CellTemplate

property from YearView.

MonthHeaderTextColor

Nil Use the

CellTemplate

property from YearView.

DateTextColor

[TextColor(From TextStyle, TodayTextStyle, LeadingDatesTextStyle, DisabledDatesTextStyle)]

Gets or sets the text color of the text style.

HeaderBackground

[Background(From HeaderView of SfCalendar)]

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

MonthLayoutBackground

Background

Gets or sets the background for the year, decade and century cells of the calendar year, decade and century view.

YearHeaderTextColor

[TextStyle(From HeaderView of SfCalendar)]

Gets or sets the text style of the header text in SfCalendar.

Enums

Xamarin SfCalendar .NET MAUI SfCalendar Description

BlackoutDatesViewMode

Nil Use the

SelectableDayPredicate

property.

CellGridOptions

Nil Using the

CellTemplate

, you can customize the month cells.

DateTextAlignment

Nil Using the

CellTemplate

, you can align the month cells text.

DayLabelTextAlignment

Nil Not Supported.

InlineViewMode

Nil Not Supported.

LabelAlignment

Nil Not Supported.

NavigationDirection

CalendarNavigationDirection

Defines the navigation direction for the SfCalendar.

SelectionMode

CalendarSelectionMode

Defines the selection mode for the SfCalendar.

SelectionShape

CalendarSelectionShape

Defines the selection shape for the SfCalendar.

TransitionMode

Nil Not Supported.

ViewMode

CalendarView

Defines the view for the SfCalendar.

YearViewMode

Nil Not Supported.

Events

Xamarin SfCalendar .NET MAUI SfCalendar Description

InlineItemTapped

Nil Not Supported.

InlineToggled

Nil Not Supported.

MonthChanged

ViewChanged

Occurs whenever the calendar view and visible dates changed on SfCalendar.

MonthChanging

Nil Not Supported.

OnCalendarTapped

Tapped

Occurs after the tap interaction on SfCalendar.

OnDateCellHolding

LongPressed

Occurs after the long press interaction on SfCalendar.

OnHeaderLoaded

Nil Customize the header view by using the properties of

HeaderView

.

OnInlineLoaded

Nil Not Supported.

OnMonthCellLoaded

Nil Customize the header view by using the properties of

MonthView

.

OnViewModeChanged

ViewChanged

Occurs whenever the calendar view and visible dates changed on SfCalendar.

OnYearCellLoaded

Nil Customize the year view by using the properties of

YearView

.

SelectionChanged

SelectionChanged

Occurs after the selection changed on SfCalendar.

Methods

Xamarin SfCalendar .NET MAUI SfCalendar Description

AddDatesInPast

EnablePastDates

Gets or sets a value indicating whether the dates are enabled or disabled before today's date.

Backward

Backward

Move to previous view which displays previous view dates.

ClearSelection

Nil You can deselect the date by using the CanToggleDaySelection property.

CollapseInlineView

Nil Not Supported.

ExpandInlineView

Nil Not Supported.

Forward

Forward

Move to next view which displays next view dates.

NavigateTo

Nil Using

DisplayDate

, you can navigate to specific date.

Refresh

Nil Not Supported.

ResumeAppointmentUpdate

Nil Not Supported.

SuspendAppointmentUpdate

Nil Not Supported.