Migrate from Xamarin.Forms SfCalendar to .NET MAUI SfCalendar

19 Sep 202312 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 Not Supported.

CalendarInlineEvent

Nil Not Supported.

MonthEventParameters

Nil Not Supported.

InlineEventArgs

Nil Not Supported.

InlineItemTappedEventArgs

Nil Not Supported.

InlineToggledEventArgs

Nil Not Supported.

MonthCell

Nil Not Supported.

MonthCellLoadedEventArgs

Nil Not Supported.

MonthChangingEventArgs

Nil Not Supported.

YearCell

Nil Not Supported.

YearCellLoadedEventArgs

Nil Not Supported.

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 Not Supported.

BlackoutDates

SelectableDayPredicate

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

BlackoutDatesViewMode

Nil Not Supported.

CustomDayLabels

Nil Not Supported.

DataSource

Nil Not Supported.

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

Nil Not Supported.

HoldCommand

Nil Not Supported.

InlineViewMode

Nil Not Supported.

Locale

Nil Not Supported.

MaxDate

MaximumDate

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

MaximumEventIndicatorCount

Nil Not Supported.

MinDate

MinimumDate

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

MonthChangedCommand

Nil Not Supported.

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 Not Supported.

NavigationArrowThickness

Nil Not Supported.

NavigationButtonHeight

Nil Not Supported.

NavigationButtonWidth

Nil Not Supported.

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

Nil Not Supported.

SelectionMode

SelectionMode

Gets or sets the selection mode of the calendar.

ShowHeader

Nil Not Supported.

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

Nil Not Supported.

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 Not Supported.

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 Not Supported.

CellGridOptions

Nil Not Supported.

CellTemplate

Nil Not Supported.

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 Not Supported.

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 Not Supported.

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 Not Supported.

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(https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Calendar.CalendarTextStyle.html#Syncfusion_Maui_Calendar_CalendarTextStyle_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

Nil Not Supported.

LabelAlignment

Nil Not Supported.

MonthHeaderBackground

Nil Not Supported.

MonthHeaderTextColor

Nil Not Supported.

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 Not Supported.

CellGridOptions

Nil Not Supported.

DateTextAlignment

Nil Not Supported.

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 Not Supported.

OnInlineLoaded

Nil Not Supported.

OnMonthCellLoaded

Nil Not Supported.

OnViewModeChanged

ViewChanged

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

OnYearCellLoaded

Nil Not Supported.

SelectionChanged

SelectionChanged

Occurs after the selection changed on SfCalendar.

Methods

Xamarin SfCalendar .NET MAUI SfCalendar Description

AddDatesInPast

Nil Not Supported.

Backward

Backward

Move to previous view which displays previous view dates.

ClearSelection

Nil Not Supported.

CollapseInlineView

Nil Not Supported.

ExpandInlineView

Nil Not Supported.

Forward

Forward

Move to next view which displays next view dates.

NavigateTo

Nil Not Supported.

Refresh

Nil Not Supported.

ResumeAppointmentUpdate

Nil Not Supported.

SuspendAppointmentUpdate

Nil Not Supported.