Class SfCalendar
Represents a control that enables a user to select a date by using a visual calendar display.
Inheritance
Implements
Namespace: Syncfusion.SfCalendar.XForms
Assembly: Syncfusion.SfCalendar.XForms.dll
Syntax
public class SfCalendar : View, IParentThemeElement, IThemeElement, IDisposable
Constructors
SfCalendar()
Initializes a new instance of the SfCalendar class.
Declaration
public SfCalendar()
Fields
AgendaViewHeightProperty
The MaximumEventIndicatorCount property determines appointment display count in monthcell.
Declaration
public static readonly BindableProperty AgendaViewHeightProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
BlackoutDatesProperty
Determines the disabled dates that restrict the user from selection.
Declaration
public static readonly BindableProperty BlackoutDatesProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
BlackoutDatesViewModeProperty
Gets or set the black out dates view mode property for schedule to define the appearance of year view in calendar. This is a bindable property.
Declaration
public static readonly BindableProperty BlackoutDatesViewModeProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
CustomDayLabelsProperty
Determines the collection of labels replaced instead of weekday labels.
Declaration
public static readonly BindableProperty CustomDayLabelsProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
DataSourceProperty
Holds the details about the events to be rendered in calendar.
Declaration
public static readonly BindableProperty DataSourceProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
DisplayDateProperty
The display date property.
Declaration
public static readonly BindableProperty DisplayDateProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
EnableDatesInPastProperty
The enable add dates in past property.
Declaration
public static readonly BindableProperty EnableDatesInPastProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
EnableSwipingProperty
The enable swiping property.
Declaration
public static readonly BindableProperty EnableSwipingProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
FirstDayofWeekProperty
Changes the first day of a week that will be applied to both month and year views.
Declaration
public static readonly BindableProperty FirstDayofWeekProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
HeaderHeightProperty
Changes the SfCalendar header height.
Declaration
public static readonly BindableProperty HeaderHeightProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
HeaderViewProperty
The thickness of navigation arrow indicator of the navigation buttons.
Declaration
public static readonly BindableProperty HeaderViewProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
HoldCommandProperty
Calendar date cell holding command property.
Declaration
public static readonly BindableProperty HoldCommandProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
InlineViewModeProperty
Determines navigations with scroll animations.
Declaration
public static readonly BindableProperty InlineViewModeProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
LocaleProperty
Defines the culture value of SfCalendar.
Declaration
public static readonly BindableProperty LocaleProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
MaxDateProperty
Gets or sets the max date. This is a bindable property.
Declaration
public static readonly BindableProperty MaxDateProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
MaximumEventIndicatorCountProperty
Determines the appointment display count in month cell.
Declaration
public static readonly BindableProperty MaximumEventIndicatorCountProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
MinDateProperty
Determines the restriction of date selection.
Declaration
public static readonly BindableProperty MinDateProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
MonthChangedCommandProperty
Calendar Month changed command property.
Declaration
public static readonly BindableProperty MonthChangedCommandProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
MonthViewSettingsProperty
The month view settings property.
Declaration
public static readonly BindableProperty MonthViewSettingsProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
MoveToDateProperty
Navigates the selection to the require date.
Declaration
public static readonly BindableProperty MoveToDateProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
NavigateToMonthOnInActiveDatesSelectionProperty
Navigates to month in the active dates selection property.
Declaration
public static readonly BindableProperty NavigateToMonthOnInActiveDatesSelectionProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
NavigationArrowThicknessProperty
The thickness of navigation arrow indicator of the navigation buttons.
Declaration
public static readonly BindableProperty NavigationArrowThicknessProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
NavigationButtonHeightProperty
Sets the navigation button height.
Declaration
public static readonly BindableProperty NavigationButtonHeightProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
NavigationButtonWidthProperty
Sets the navigation button width.
Declaration
public static readonly BindableProperty NavigationButtonWidthProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
NavigationDirectionProperty
The ViewMode
property that determines the view of the SfCalendar control in month or year.
Declaration
public static readonly BindableProperty NavigationDirectionProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
NullableSelectedDateProperty
Determines the selected date in the SfCalendar control with SingleSelection mode.
Declaration
public static readonly BindableProperty NullableSelectedDateProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
NumberOfWeeksInViewProperty
Gets or sets the Number of Weeks in View property for calendar to define the number of weeks to display in month view. This is a bindable property.
Declaration
public static readonly BindableProperty NumberOfWeeksInViewProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
SelectedDateProperty
The selected date property determines the selected date in SfCalendar control with SingleSelection mode.
Declaration
public static readonly BindableProperty SelectedDateProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
SelectedDatesProperty
Determines the selected dates in the SfCalendar control with Multiple or Range selection mode.
Declaration
public static readonly BindableProperty SelectedDatesProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
SelectedRangeProperty
Determines the selected range in the SfCalendar control with Range selection mode.
Declaration
public static readonly BindableProperty SelectedRangeProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
SelectionChangedCommandProperty
Calendar Selection changed command property.
Declaration
public static readonly BindableProperty SelectionChangedCommandProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
SelectionModeProperty
Gets or sets the selection mode. This is a bindable property. SelecionMode has three types: SingleSelection, MultiSelection, and RangeSelection.
Declaration
public static readonly BindableProperty SelectionModeProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
ShowHeaderProperty
The show header property has true
as default value.
Declaration
public static readonly BindableProperty ShowHeaderProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
ShowInlineEventsProperty
Determines whether the inline events has to be showed or not.
Declaration
public static readonly BindableProperty ShowInlineEventsProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
ShowLeadingAndTrailingDaysProperty
The show leading and trailing days property.
Declaration
public static readonly BindableProperty ShowLeadingAndTrailingDaysProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
ShowNavigationButtonsProperty
The show navigation buttons property.
Declaration
public static readonly BindableProperty ShowNavigationButtonsProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
ShowYearViewProperty
Determines whether year view has to be showed or not.
Declaration
public static readonly BindableProperty ShowYearViewProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
TapCommandProperty
Calendar cell tapped command property.
Declaration
public static readonly BindableProperty TapCommandProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
ToggleDaySelectionProperty
The toggle day selection property.
Declaration
public static readonly BindableProperty ToggleDaySelectionProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
TransitionModeProperty
Determines the navigations with scroll animations.
Declaration
public static readonly BindableProperty TransitionModeProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
ViewModeProperty
ViewMode
property determines the view of SfCalendar control in MonthView or YearView.
Declaration
public static readonly BindableProperty ViewModeProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
VisibleDatesProperty
Determines the visible dates of the month view.
Declaration
public static readonly BindableProperty VisibleDatesProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
YearViewModeProperty
Gets or set the year view mode property for schedule to define the appearance of year view in calendar. This is a bindable property.
Declaration
public static readonly BindableProperty YearViewModeProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
YearViewSettingsProperty
The year view settings property.
Declaration
public static readonly BindableProperty YearViewSettingsProperty
Field Value
Type |
---|
Xamarin.Forms.BindableProperty |
Properties
AgendaViewHeight
Gets or sets the value to customize the height of the agenda view in MonthView.
Declaration
public double AgendaViewHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The value used to customize the height of the agenda view in MonthView. |
See Also
BlackoutDates
Gets or sets the blackout dates.
Declaration
public IList<DateTime> BlackoutDates { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<System.DateTime> | The blackout dates. |
BlackoutDatesViewMode
Gets or sets the black out dates view mode property for month view to define the appearance of blackout dates in calendar.
Declaration
public BlackoutDatesViewMode BlackoutDatesViewMode { get; set; }
Property Value
Type | Description |
---|---|
BlackoutDatesViewMode | The view mode. |
Remarks
BlackoutDatesViewMode property not applicable for UWP.
CustomDayLabels
Gets or sets the custom day labels.
Declaration
public IList<string> CustomDayLabels { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<System.String> | The custom day labels. |
DataSource
Gets or sets the calendar event collection to displays the events with indicator by the SfCalendar using its built-in capability.
Declaration
public CalendarEventCollection DataSource { get; set; }
Property Value
Type | Description |
---|---|
CalendarEventCollection | The data source is the calendar event collection used to displays the event by SfCalendar. For events to be listed for a particular day, enable the inline feature in the month view cell. |
Examples
<?xml version = "1.0" encoding="utf-8"?>
<ContentPage xmlns = "http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:CalendarSample" x:Class="CalendarSample.MainPage" xmlns:syncfusion="clr-namespace:Syncfusion.SfCalendar.XForms;assembly=Syncfusion.SfCalendar.XForms">
<syncfusion:SfCalendar.BindingContext>
<local:CalendarViewModel/>
</syncfusion:SfCalendar.BindingContext>
<syncfusion:SfCalendar x:Name="calendar"
ViewMode="MonthView"
ShowInlineEvents="True"
InlineViewMode="Inline"
MaximumEventIndicatorCount="1"
DataSource="{Binding CalendarInlineEvents}">
</syncfusion:SfCalendar>
</ContentPage>
public class CalendarViewModel
{
public CalendarEventCollection CalendarInlineEvents { get; set; } = new CalendarEventCollection();
public CalendarViewModel()
{
CalendarInlineEvent event1 = new CalendarInlineEvent();
event1.StartTime = new DateTime(2017, 5, 1, 5, 0, 0);
event1.EndTime = new DateTime(2017, 5, 1, 7, 0, 0);
event1.Subject = "Go to Meeting";
event1.Color = Color.Fuchsia;
CalendarInlineEvent event2 = new CalendarInlineEvent();
event2.StartTime = new DateTime(2017, 5, 1, 10, 0, 0);
event2.EndTime = new DateTime(2017, 5, 1, 12, 0, 0);
event2.Subject = "Planning";
event2.Color = Color.Green;
CalendarInlineEvents.Add(event1);
CalendarInlineEvents.Add(event2);
}
}
See Also
DisplayDate
Gets the display date. This is bindable property.
Declaration
public DateTime DisplayDate { get; }
Property Value
Type | Description |
---|---|
System.DateTime | The display date. |
EnableDatesInPast
Gets or sets a value indicating whether SfCalendar enable add dates in the past or not.
Declaration
public bool EnableDatesInPast { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
EnableSwiping
Gets or sets a value indicating whether SfCalendar allows to switch between previous and next views by swiping or not.
Declaration
public bool EnableSwiping { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True to enable swiping to switch between previous and next views. False to restrict the swiping. |
Remarks
Swiping of SfCalendar has been restricted only with RangeSelection. With that RangeSelection mode can swipe the month by using navigation buttons.
See Also
FirstDayofWeek
Gets or sets the first day of a week.This is a bindable property.
Declaration
public int FirstDayofWeek { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The first day of week. |
HeaderHeight
Gets or sets the height of the header.
Declaration
public float HeaderHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The height of the header. |
HeaderView
Gets or sets the UI elements for header of the SfCalendar.
Declaration
public View HeaderView { get; set; }
Property Value
Type |
---|
Xamarin.Forms.View |
Remarks
The HeaderView is a custom view for the SfCalendar header. The interaction of the header view is managed by user end for switching among month, year, decade and century views.
HoldCommand
Gets or sets the System.Windows.Input.ICommand which will be executed when the calendar date is long pressed.
Declaration
public ICommand HoldCommand { get; set; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
Examples
<calendar:SfCalendar x:Name="calendar" HoldCommand="{Binding OnDateCellHolding}">
<calendar:SfCalendar.BindingContext>
<local:CalendarViewModel/>
</calendar:SfCalendar.BindingContext>
</calendar:SfCalendar>
public class CalendarViewModel
{
public ICommand OnDateCellHolding { get; set; }
public CalendarViewModel()
{
OnDateCellHolding = new Command<DayCellHoldingEventArgs>(DateCellHolding);
}
private void DateCellHolding(DayCellHoldingEventArgs obj)
{
}
}
InlineViewMode
Gets or sets the value which handles the appointments display in the month view.
Declaration
public InlineViewMode InlineViewMode { get; set; }
Property Value
Type | Description |
---|---|
InlineViewMode | The InlineViewMode used to handle the appointments display in the month view. |
Remarks
If there is no appointment for the selected day, then Inline and Agenda view displays the text as No Appointments. The Inline and Agenda view will be available only in the month view with single selection mode.
See Also
Locale
Gets or sets the locale. The SfCalendar control is available with en-US locale by default.
Declaration
public CultureInfo Locale { get; set; }
Property Value
Type | Description |
---|---|
System.Globalization.CultureInfo | The locale. |
MaxDate
Gets or sets the maximum vsiible dates of SfCalendar can be selected which applicable for all the views.
Declaration
public DateTime MaxDate { get; set; }
Property Value
Type | Description |
---|---|
System.DateTime | The maximum visible dates of SfCalendar can be selected. |
Remarks
The inline feature in month view will work only within the min max date range. Date navigation features of move to date will be restricted. Cannot swipe the control using touch gesture. Selection does not work for month view. The tapped delegates will not be triggered while tapped on the MonthCell.
See Also
MaximumEventIndicatorCount
Gets or sets the value which customize the number of appointment indicators displayed in the month cell.
Declaration
public int MaximumEventIndicatorCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The MaximumEventIndicatorCount used to customzie the number of appointment indicators to be displayed in the month cell. Default value is 5. |
Remarks
If appointments count are lesser than the appointment indicator count value in the particular day, then according to number of appointments available, indicator will be displayed in the month cell. Appointment indicator will be shown on the basis of date meetings, usable month cell size and indicator count. For eg, if the month cell size is less(available for only 4 dots) and the indicator count is 10, then 4 indicators will be displayed.
See Also
MinDate
Gets or sets the minimum vsiible dates of SfCalendar can be selected which applicable for all the views.
Declaration
public DateTime MinDate { get; set; }
Property Value
Type | Description |
---|---|
System.DateTime | The minimum visible dates of SfCalendar can be selected. |
Remarks
The inline feature in month view will work only within the min max date range. Date navigation features of move to date will be restricted. Cannot swipe the control using touch gesture. Selection does not work for month view. The tapped delegates will not be triggered while tapped on the MonthCell.
See Also
MonthChangedCommand
Gets or sets the System.Windows.Input.ICommand which will be executed when the month is changed in calendar.
Declaration
public ICommand MonthChangedCommand { get; set; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
Examples
<calendar:SfCalendar x:Name="calendar" MonthChangedCommand="{Binding OnMonthChanged}"">
<calendar:SfCalendar.BindingContext>
<local:CalendarViewModel/>
</calendar:SfCalendar.BindingContext>
</calendar:SfCalendar>
public class CalendarViewModel
{
public ICommand OnMonthChanged { get; set; }
public CalendarViewModel()
{
OnMonthChanged = new Command<MonthChangedEventArgs>(MonthChanged);
}
private void MonthChanged(MonthChangedEventArgs args)
{
}
}
MonthViewSettings
Gets or sets properties which allow to customize the month view of the SfCalendar.
Declaration
public MonthViewSettings MonthViewSettings { get; set; }
Property Value
Type | Description |
---|---|
MonthViewSettings | The properties settings used to customize teh month view. |
Examples
<?xml version = "1.0" encoding="utf-8"?>
<syncfusion:SfCalendar x:Name="calendar">
<syncfusion:SfCalendar.MonthViewSettings>
<syncfusion:MonthViewSettings
CurrentMonthBackgroundColor = "#800080"
CurrentMonthTextColor="#ffffff"
PreviousMonthBackgroundColor="#9895F0"
PreviousMonthTextColor="#000000"
DateSelectionColor="#ffffff"
SelectedDayTextColor="#000000"
DayHeaderFormat="EEEEE"
DayFontSize="12"
DayHeaderFontSize="14"
DayHeaderBackgroundColor="#fed766"
SelectionRadius="15"
TodaySelectionTextColor="Black"
TodaySelectionBackgroundColor="Green"
DayHeaderTextColor="Black"
HeaderBackgroundColor="Pink"
HeaderFontAttributes="Italic"
HeaderFontSize="16"
WeekEndTextColor="#fe4a49"
WeekEndBackgroundColor="#2ab7ca">
<syncfusion:MonthViewSettings.HeaderFontFamily>
<OnPlatform x:TypeArguments="x:String" iOS="Lobster-Regular" Android="Lobster-Regular.ttf" WinPhone="Assets/Lobster-Regular.ttf#Lobster" />
</syncfusion:MonthViewSettings.HeaderFontFamily>
<syncfusion:MonthViewSettings.DayHeaderFontFamily>
<OnPlatform x:TypeArguments="x:String" iOS="Lobster-Regular" Android="Lobster-Regular.ttf" WinPhone="Assets/Lobster-Regular.ttf#Lobster" />
</syncfusion:MonthViewSettings.DayHeaderFontFamily>
<syncfusion:MonthViewSettings.DayCellFontFamily>
<OnPlatform x:TypeArguments="x:String" iOS="Lobster-Regular" Android="Lobster-Regular.ttf" WinPhone="Assets/Lobster-Regular.ttf#Lobster" />
</syncfusion:MonthViewSettings.DayCellFontFamily>
</syncfusion:MonthViewSettings>
</syncfusion:SfCalendar.MonthViewSettings>
</syncfusion:SfCalendar>
SfCalendar calendar = new SfCalendar();
MonthViewSettings monthViewSettings = new MonthViewSettings();
monthViewSettings.CurrentMonthBackgroundColor = Color.FromHex("#800080");
monthViewSettings.CurrentMonthTextColor = Color.FromHex("#ffffff");
monthViewSettings.PreviousMonthBackgroundColor = Color.FromHex("#9895F0");
monthViewSettings.PreviousMonthTextColor = Color.FromHex("#000000");
monthViewSettings.DateSelectionColor = Color.FromHex("#ffffff");
monthViewSettings.SelectedDayTextColor = Color.FromHex("#000000");
monthViewSettings.DayHeaderFormat = "EEEEE";
monthViewSettings.DayFontSize = 12;
monthViewSettings.DayHeaderFontSize = 14;
monthViewSettings.DayHeaderBackgroundColor = Color.FromHex("#fed766");
monthViewSettings.SelectionRadius = 15;
monthViewSettings.TodaySelectionTextColor = Color.Black;
monthViewSettings.TodaySelectionBackgroundColor = Color.Green;
monthViewSettings.DayHeaderTextColor = Color.Black;
monthViewSettings.DayHeaderFontFamily = Device.OnPlatform("Lobster-Regular", "Lobster-Regular.ttf", "Assets/Lobster-Regular.ttf#Lobster");
monthViewSettings.HeaderBackgroundColor = Color.Pink;
monthViewSettings.HeaderFontAttributes = FontAttributes.Italic;
monthViewSettings.HeaderFontFamily = Device.OnPlatform("Lobster-Regular", "Lobster-Regular.ttf", "Assets/Lobster-Regular.ttf#Lobster");
monthViewSettings.HeaderFontSize = 16;
monthViewSettings.DayCellFontFamily = Device.OnPlatform("Lobster-Regular", "Lobster-Regular.ttf", "Assets/Lobster-Regular.ttf#Lobster");
monthViewSettings.WeekEndTextColor = Color.FromHex("#fe4a49");
monthViewSettings.WeekEndBackgroundColor = Color.FromHex("#2ab7ca");
monthViewSettings.AgendaSelectedDateColor = Color.Blue;
calendar.MonthViewSettings = monthViewSettings;
this.Content = calendar;
See Also
MoveToDate
Gets or sets the value used to move the visible dates to a particular SfCalendar date.
Declaration
public DateTime MoveToDate { get; set; }
Property Value
Type | Description |
---|---|
System.DateTime | The move to date will move to any specific month,year,decade,century view based on the ViewMode. |
Remarks
The specified date should lie between MinDate and MaxDate, if the specified date is greater than MaxDate then the view will be moved to MaxDate and if the specified date is lesser than the MinDate then the view will be moved to MinDate.
See Also
NavigateToMonthOnInActiveDatesSelection
Gets or sets a value indicating whether SfCalendar navigate to month in active dates selection or not.
Declaration
public bool NavigateToMonthOnInActiveDatesSelection { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
NavigationArrowThickness
Gets or sets the navigation arrow thickness.
Declaration
public float NavigationArrowThickness { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The navigation arrow thickness. |
NavigationButtonHeight
Gets or sets the height of the navigation button.
Declaration
public float NavigationButtonHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The height of the navigation button. |
NavigationButtonWidth
Gets or sets the width of the navigation button.
Declaration
public float NavigationButtonWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The width of the navigation button. |
NavigationDirection
Gets or sets the direction that navigating the SfCalendar views such as MonthView, YeraView, DecadeView and CenturyView either vertical or horizontal.
Declaration
public NavigationDirection NavigationDirection { get; set; }
Property Value
Type | Description |
---|---|
NavigationDirection | If this property set as Vertical the SfCalendar will navigate to the previous/next views in the vertical direction instead of the horizontal direction. Defaults to Horizontal. |
See Also
NullableSelectedDate
Gets or sets the selected date. This is a bindable property.
Declaration
public Nullable<DateTime> NullableSelectedDate { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> | The selected date. |
NumberOfWeeksInView
Gets or sets the number of weeks in the month view of the SfCalendar.
Declaration
public int NumberOfWeeksInView { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | Displays the number of weeks in view. By default, it starts from the current week, and this can be modified using the MoveToDate property of calendar. |
Remarks
NumberOfWeeksInView is applicable only for the month view of the SfCalendar. ShowLeadingAndTrailingDays is not applicable if the NumberOfWeeksInView is lesser than 6. Week number ranges from 1 to 6. If lesser or greater than these range is considered, NumberOfWeeksInView will be displayed as 6. Inline view considers NumberOfWeeksInView as only 6. For other count, only agenda view will be displayed in calendar. Dynamically changing NumberOfWeeksInView shows the first row of month view dates. It can be handled using the MoveToDate property of calendar.
See Also
SelectedDate
Gets or sets the selected date programmatically by binding it from the view model.
Declaration
public Nullable<DateTime> SelectedDate { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> | The selected date. |
Remarks
The SelectedDate property can only be bound when the SelectionMode is set to SingleSelection in the SfCalendar.
Examples
<?xml version = "1.0" encoding="utf-8"?>
<calendar:SfCalendar x:Name="calendar"
ShowInlineEvents="True"
SelectionMode="SingleSelection"
SelectedDate="{Binding SelectedDate, Mode=TwoWay}">
</calendar:SfCalendar>
calendar.SetBinding(SfCalendar.SelectedDateProperty, new Binding("SelectedDate", BindingMode.TwoWay));
public class MainViewModel
{
public DateTime SelectedDate { get; set; }
public MainViewModel()
{
SelectedDate = new DateTime(2019, 02, 05);
}
}
See Also
SelectedDates
Gets or sets the list of selected dates. This is a bindable property.
Declaration
public List<DateTime> SelectedDates { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<System.DateTime> | The selected date. |
SelectedRange
Gets or sets the selected range. This is a bindable property.
Declaration
public object SelectedRange { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The selected range. |
SelectionChangedCommand
Gets or sets the System.Windows.Input.ICommand which will be executed when the selection is changed in calendar.
Declaration
public ICommand SelectionChangedCommand { get; set; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
Examples
<calendar:SfCalendar x:Name="calendar" SelectionChangedCommand="{Binding OnSelectionChanged}">
<calendar:SfCalendar.BindingContext>
<local:CalendarViewModel/>
</calendar:SfCalendar.BindingContext>
</calendar:SfCalendar>
public class CalendarViewModel
{
public ICommand OnSelectionChanged { get; set; }
public CalendarViewModel()
{
OnSelectionChanged = new Command<Syncfusion.SfCalendar.XForms.SelectionChangedEventArgs>(SelectionChanged);
}
private void SelectionChanged(Syncfusion.SfCalendar.XForms.SelectionChangedEventArgs args)
{
}
}
SelectionMode
Gets or sets the value to selects the dates in two modes such as single and multiple selection.
Declaration
public SelectionMode SelectionMode { get; set; }
Property Value
Type | Description |
---|---|
SelectionMode | The selection mode used to select the dates in teo modes such as single or multiple selection. |
Remarks
Selection does not work for the month view beyond the min and max date range.
See Also
ShowHeader
Gets or sets a value indicating whether SfCalendar show header.
Declaration
public bool ShowHeader { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
ShowInlineEvents
Gets or sets a value indicating whether SfCalendar show inline events or not.
Declaration
public bool ShowInlineEvents { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
ShowLeadingAndTrailingDays
Gets or sets a value indicating whether this SfCalendar show leading and trailing days.
Declaration
public bool ShowLeadingAndTrailingDays { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
ShowNavigationButtons
Gets or sets a value indicating whether to show navigation buttons. It is mainly used in RangeSelection mode.
Declaration
public bool ShowNavigationButtons { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The show navigation buttons. |
ShowYearView
Gets or sets a value indicating whether SfCalendar show year view or not.
Declaration
public bool ShowYearView { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
TapCommand
Gets or sets the System.Windows.Input.ICommand which will be executed when the calendar date is tapped.
Declaration
public ICommand TapCommand { get; set; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
Examples
<calendar:SfCalendar x:Name="calendar" TapCommand="{Binding CalendarCellTapped}">
<calendar:SfCalendar.BindingContext>
<local:CalendarViewModel/>
</calendar:SfCalendar.BindingContext>
</calendar:SfCalendar>
public class CalendarViewModel
{
public ICommand CalendarCellTapped { get; set; }
public CalendarViewModel()
{
CalendarCellTapped = new Command<CalendarTappedEventArgs>(CellTapped);
}
private void CellTapped(CalendarTappedEventArgs obj)
{
}
}
ToggleDaySelection
Gets or sets a value indicating whether SfCalendar toggle day selection.
Declaration
public bool ToggleDaySelection { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
TransitionMode
Gets or sets the transition mode.
Declaration
public TransitionMode TransitionMode { get; set; }
Property Value
Type | Description |
---|---|
TransitionMode | The transition mode. |
ViewMode
Gets or sets the built in views such month, year, decade and century of the SfCalendar.
Declaration
public ViewMode ViewMode { get; set; }
Property Value
Type | Description |
---|---|
ViewMode | The default view mode is MonthView. It allows users to easily select and navigate between all built-in views. |
See Also
VisibleDates
Gets the visible dates.
Declaration
public IList<DateTime> VisibleDates { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<System.DateTime> | The visible dates. |
YearViewMode
Gets or sets if the SfCalendar shows year view as the entire month with dates or all months of the year.
Declaration
public YearViewMode YearViewMode { get; set; }
Property Value
Type | Description |
---|---|
YearViewMode | Date displays all the months with dates in a particular year view. Month displays all the months in a particular year view. |
Remarks
The YearViewMode property is only applicable for calendar in Android and iOS platforms.
See Also
YearViewSettings
Gets or sets properties which allow to customize the year, decade and century view of the SfCalendar.
Declaration
public YearViewSettings YearViewSettings { get; set; }
Property Value
Type | Description |
---|---|
YearViewSettings | The year view settings. |
Examples
<?xml version = "1.0" encoding="utf-8"?>
<syncfusion:SfCalendar x:Name="calendar">
<syncfusion:SfCalendar.YearViewSettings>
<syncfusion:YearViewSettings
LayoutBackground = "#ffe4b5"
DateTextColor="#E6E6FA"
HeaderBackground="#8B4513"
YearHeaderTextColor="#FFFFFF"
MonthHeaderBackground="#bfff00"
LabelAlignment="Centre" />
</syncfusion:SfCalendar.YearViewSettings>
</syncfusion:SfCalendar>
SfCalendar calendar = new SfCalendar();
YearViewSettings yearViewSettings = new YearViewSettings();
yearViewSettings.LayoutBackground = Color.FromHex("#ffe4b5");
yearViewSettings.DateTextColor = Color.FromHex("#008000");
yearViewSettings.YearHeaderTextColor = Color.FromHex("#ff0000");
yearViewSettings.MonthHeaderBackground = Color.FromHex("#bfff00");
yearViewSettings.LabelAlignment = LabelAlignment.Centre;
calendar.YearViewSettings = yearViewSettings;
this.Content = calendar;
See Also
Methods
AddDatesInPast()
Adds the dates in past.
Declaration
public void AddDatesInPast()
Backward()
Moves to the previous view programmatically with animation by checking that the previous view dates falls between the minimum and maximum date range.
Declaration
public void Backward()
Remarks
If the current view has the minimum date range, it will not move to the previous view.
See Also
ClearSelection()
Method to clear the date selection in calendar.
Declaration
public void ClearSelection()
CollapseInlineView(DateTime)
Provides support to collapse the inline view that holds the appointments details of the corresponding date.
Declaration
public void CollapseInlineView(DateTime date)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | date | Date. |
Dispose()
Releases all resources used by the SfCalendar object.
Declaration
public void Dispose()
Remarks
Call Dispose() when you are finished using the SfCalendar. The Dispose() method leaves the SfCalendar in an unusable state. After calling Dispose(), you must release all references to the SfCalendar so the garbage collector can reclaim the memory that the SfCalendar was occupying.
Dispose(Boolean)
Releases all resources used by the SfCalendar object.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | Indicating whether the object is disposing or not. |
ExpandInlineView(DateTime)
Provides support to expand the inline view that holds the appointments details of the corresponding date.
Declaration
public void ExpandInlineView(DateTime date)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | date | Date. |
Forward()
Moves to the next view programmatically with animation by checking that the next view dates falls between the minimum and maximum date range.
Declaration
public void Forward()
Remarks
If the current view has the maximum date range, it will not move to the next view.
See Also
NavigateTo(DateTime)
Navigates the view to the specified visible date.
Declaration
public void NavigateTo(DateTime date)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | date | Date. |
OnMeasure(Double, Double)
Called during the measure pass of a layout cycle to get the desired size of an element.
Declaration
protected override SizeRequest OnMeasure(double widthConstraint, double heightConstraint)
Parameters
Type | Name | Description |
---|---|---|
System.Double | widthConstraint | The available width for the element to use. |
System.Double | heightConstraint | The available height for the element to use. |
Returns
Type | Description |
---|---|
Xamarin.Forms.SizeRequest | Size request. |
Refresh()
Provides support for refreshing the calendar view.
Declaration
public void Refresh()
ResumeAppointmentUpdate()
Resume the appointment collection update for calendar to update the appointments to calendar data source.
Declaration
public void ResumeAppointmentUpdate()
SuspendAppointmentUpdate()
Suspends the appointment collection update for calendar to prevent the data source collection update until the resume appointment update method call.
Declaration
public void SuspendAppointmentUpdate()
Events
InlineItemTapped
Triggers when inline item tapped.
Declaration
public event EventHandler<InlineItemTappedEventArgs> InlineItemTapped
Event Type
Type |
---|
System.EventHandler<InlineItemTappedEventArgs> |
InlineToggled
Triggers when inline view is toggled.
Declaration
public event EventHandler<InlineToggledEventArgs> InlineToggled
Event Type
Type |
---|
System.EventHandler<InlineToggledEventArgs> |
MonthChanged
On Month Changed event
Declaration
public event EventHandler<MonthChangedEventArgs> MonthChanged
Event Type
Type |
---|
System.EventHandler<MonthChangedEventArgs> |
MonthChanging
Triggers when calendar month changes
Declaration
public event EventHandler<MonthChangingEventArgs> MonthChanging
Event Type
Type |
---|
System.EventHandler<MonthChangingEventArgs> |
OnCalendarTapped
Returns calendar tapped event args
Declaration
public event EventHandler<CalendarTappedEventArgs> OnCalendarTapped
Event Type
Type |
---|
System.EventHandler<CalendarTappedEventArgs> |
OnDateCellHolding
On Date cell Holding event
Declaration
public event EventHandler<DayCellHoldingEventArgs> OnDateCellHolding
Event Type
Type |
---|
System.EventHandler<DayCellHoldingEventArgs> |
OnHeaderLoaded
Header loaded event to customize calendar header view
Declaration
public event EventHandler<CalendarHeaderEventArgs> OnHeaderLoaded
Event Type
Type |
---|
System.EventHandler<CalendarHeaderEventArgs> |
OnInlineLoaded
Inline loaded event to customize inline view
Declaration
public event EventHandler<InlineEventArgs> OnInlineLoaded
Event Type
Type |
---|
System.EventHandler<InlineEventArgs> |
OnMonthCellLoaded
Month cell loaded event to customize calendar month view
Declaration
public event EventHandler<MonthCellLoadedEventArgs> OnMonthCellLoaded
Event Type
Type |
---|
System.EventHandler<MonthCellLoadedEventArgs> |
OnViewModeChanged
Triggers when view mode changed
Declaration
public event EventHandler<ViewModeChangedEventArgs> OnViewModeChanged
Event Type
Type |
---|
System.EventHandler<ViewModeChangedEventArgs> |
OnYearCellLoaded
Year cell loaded event to customize calendar Year view
Declaration
public event EventHandler<YearCellLoadedEventArgs> OnYearCellLoaded
Event Type
Type |
---|
System.EventHandler<YearCellLoadedEventArgs> |
SelectionChanged
Triggers when calendar selection changes
Declaration
public event EventHandler<SelectionChangedEventArgs> SelectionChanged
Event Type
Type |
---|
System.EventHandler<SelectionChangedEventArgs> |