MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class CalendarMonthView

    Show / Hide Table of Contents

    Class CalendarMonthView

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

    Inheritance
    System.Object
    CalendarMonthView
    Namespace: Syncfusion.Maui.Calendar
    Assembly: Syncfusion.Maui.Calendar.dll
    Syntax
    public class CalendarMonthView : BindableObject

    Constructors

    CalendarMonthView()

    Declaration
    public CalendarMonthView()

    Fields

    BackgroundProperty

    Identifies the Background dependency property.

    Declaration
    public static readonly BindableProperty BackgroundProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for Background dependency property.

    CellTemplateProperty

    Identifies the CellTemplate dependency property.

    Declaration
    public static readonly BindableProperty CellTemplateProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for CellTemplate dependency property.

    DisabledDatesBackgroundProperty

    Identifies the DisabledDatesBackground dependency property.

    Declaration
    public static readonly BindableProperty DisabledDatesBackgroundProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for DisabledDatesBackground dependency property.

    DisabledDatesTextStyleProperty

    Identifies the DisabledDatesTextStyle dependency property.

    Declaration
    public static readonly BindableProperty DisabledDatesTextStyleProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for DisabledDatesTextStyle dependency property.

    FirstDayOfWeekProperty

    Identifies the FirstDayOfWeek dependency property.

    Declaration
    public static readonly BindableProperty FirstDayOfWeekProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for FirstDayOfWeek dependency property.

    HeaderViewProperty

    Identifies the HeaderView dependency property.

    Declaration
    public static readonly BindableProperty HeaderViewProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for HeaderView dependency property.

    NumberOfVisibleWeeksProperty

    Identifies the NumberOfVisibleWeeks dependency property.

    Declaration
    public static readonly BindableProperty NumberOfVisibleWeeksProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for NumberOfVisibleWeeks dependency property.

    RangeTextStyleProperty

    Identifies the RangeTextStyle dependency property.

    Declaration
    public static readonly BindableProperty RangeTextStyleProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for RangeTextStyle dependency property.

    SelectionTextStyleProperty

    Identifies the SelectionTextStyle dependency property.

    Declaration
    public static readonly BindableProperty SelectionTextStyleProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for SelectionTextStyle dependency property.

    ShowWeekNumberProperty

    Identifies the ShowWeekNumber dependency property.

    Declaration
    public static readonly BindableProperty ShowWeekNumberProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for ShowWeekNumber dependency property.

    SpecialDatesBackgroundProperty

    Identifies the SpecialDatesBackground dependency property.

    Declaration
    public static readonly BindableProperty SpecialDatesBackgroundProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for SpecialDatesBackground dependency property.

    SpecialDatesProperty

    Identifies the SpecialDates dependency property.

    Declaration
    public static readonly BindableProperty SpecialDatesProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for SpecialDates dependency property.

    SpecialDatesTextStyleProperty

    Identifies the SpecialDatesTextStyle dependency property.

    Declaration
    public static readonly BindableProperty SpecialDatesTextStyleProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for SpecialDatesTextStyle dependency property.

    SpecialDayPredicateProperty

    Identifies the SpecialDayPredicate dependency property.

    Declaration
    public static readonly BindableProperty SpecialDayPredicateProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for SpecialDayPredicate dependency property.

    TextStyleProperty

    Identifies the TextStyle dependency property.

    Declaration
    public static readonly BindableProperty TextStyleProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for TextStyle dependency property.

    TodayBackgroundProperty

    Identifies the TodayBackground dependency property.

    Declaration
    public static readonly BindableProperty TodayBackgroundProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for TodayBackground dependency property.

    TodayTextStyleProperty

    Identifies the TodayTextStyle dependency property.

    Declaration
    public static readonly BindableProperty TodayTextStyleProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for TodayTextStyle dependency property.

    TrailingLeadingDatesBackgroundProperty

    Identifies the TrailingLeadingDatesBackground dependency property.

    Declaration
    public static readonly BindableProperty TrailingLeadingDatesBackgroundProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for TrailingLeadingDatesBackground dependency property.

    TrailingLeadingDatesTextStyleProperty

    Identifies the TrailingLeadingDatesTextStyle dependency property.

    Declaration
    public static readonly BindableProperty TrailingLeadingDatesTextStyleProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for TrailingLeadingDatesTextStyle dependency property.

    WeekendDatesBackgroundProperty

    Identifies the WeekendDatesBackground dependency property.

    Declaration
    public static readonly BindableProperty WeekendDatesBackgroundProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for WeekendDatesBackground dependency property.

    WeekendDatesTextStyleProperty

    Identifies the WeekendDatesTextStyle dependency property.

    Declaration
    public static readonly BindableProperty WeekendDatesTextStyleProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for WeekendDatesTextStyle dependency property.

    WeekendDaysProperty

    Identifies the WeekendDays dependency property.

    Declaration
    public static readonly BindableProperty WeekendDaysProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for WeekendDays dependency property.

    WeekNumberStyleProperty

    Identifies the WeekNumberStyle dependency property.

    Declaration
    public static readonly BindableProperty WeekNumberStyleProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for WeekNumberStyle dependency property.

    Properties

    Background

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

    Declaration
    public Brush Background { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.Brush
    Examples

    The default value of Background is Transparent. MonthView TextStyle The following code demonstrates, how to use the Background property in the calendar

    this.Calendar.MonthView.Background = Colors.PaleGreen;

    CellTemplate

    Gets or sets the month cell template or template selector.

    Declaration
    public DataTemplate CellTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.DataTemplate

    The default value of CellTemplate is null.

    Remarks

    The BindingContext of the CellTemplate is the CalendarCellDetails If the cell template is not null, Range selection direction of forward, backward and both direction does not drawn the dashed line hovering. Hovering draws like default range selection direction.

    Examples

    The following code demonstrates, how to use the Cell Template property in the month view. #XAML

    <calendar:SfCalendar x:Name= "Calendar">
                 < calendar:SfCalendar.MonthView>
                     <calendar:CalendarMonthView>
                         <calendar:CalendarMonthView.CellTemplate>
                             <DataTemplate>
                                 <Grid BackgroundColor = "Pink" >
                                     < Label HorizontalTextAlignment= "Center" VerticalTextAlignment= "Center" TextColor= "Purple" Text= "{Binding Date.Day}" />
                                 </Grid >
                             </ DataTemplate >
                         </ calendar:CalendarMonthView.CellTemplate>
                     </calendar:CalendarMonthView>
                 </calendar:SfCalendar.MonthView>
    </calendar:SfCalendar>
    • C#
    this.Calendar.MonthView = new CalendarMonthView()
    {
        CellTemplate = dataTemplate,
    };
    
    DataTemplate dataTemplate = new DataTemplate(() =>
    {
         Grid grid = new Grid
         {
             BackgroundColor = Colors.Pink,
         };
    
         Label label = new Label
         {
             HorizontalTextAlignment = TextAlignment.Center,
             VerticalTextAlignment = TextAlignment.Center,
             TextColor = Colors.Purple,
         };
    
         label.SetBinding(Label.TextProperty, new Binding("Date.Day"));
         grid.Children.Add(label);
         return grid;
     });
    See Also
    Date
    IsTrailingOrLeadingDate
    SelectionMode

    DisabledDatesBackground

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

    Declaration
    public Brush DisabledDatesBackground { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.Brush

    The default value of DisabledDatesBackground is Transparent.

    Examples

    The following code demonstrates, how to use the DisabledDatesBackground property in the calendar

    this.Calendar.MonthView.DisabledDatesBackground = Colors.Grey;
    See Also
    MonthView
    MinimumDate
    MaximumDate
    EnablePastDates
    SelectableDayPredicate
    DisabledDatesTextStyle

    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.

    Declaration
    public CalendarTextStyle DisabledDatesTextStyle { get; set; }
    Property Value
    Type Description
    CalendarTextStyle
    Examples

    The following code demonstrates, how to use the DisabledDatesTextStyle property in the calendar

    CalendarTextStyle textStyle = new CalendarTextStyle()
    {
        FontSize = 12,
        TextColor = Colors.Red,
    };
    this.Calendar.MonthView.DisabledDatesTextStyle = textStyle;
    See Also
    MaximumDate
    MinimumDate
    EnablePastDates
    SelectableDayPredicate
    MonthView
    DisabledDatesBackground

    FirstDayOfWeek

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

    Declaration
    public DayOfWeek FirstDayOfWeek { get; set; }
    Property Value
    Type Description
    System.DayOfWeek

    The default value of FirstDayOfWeek is System.DayOfWeek.Sunday.

    Examples

    The following code demonstrates, how to use the FirstDayOfWeek property in the calendar

    this.Calendar.MonthView.FirstDayOfWeek = Sunday;
    See Also
    MonthView

    HeaderView

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

    Declaration
    public CalendarMonthHeaderView HeaderView { get; set; }
    Property Value
    Type Description
    CalendarMonthHeaderView
    Examples

    The following code demonstrates, how to use the HeaderView property in the calendar

    this.calendar.MonthView.HeaderView = new CalendarMonthHeaderView()
    {
    	Background = Colors.Yellow,
    	TextFormat = "ddd"
    };
    See Also
    MonthView

    NumberOfVisibleWeeks

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

    Declaration
    public int NumberOfVisibleWeeks { get; set; }
    Property Value
    Type Description
    System.Int32

    The default value of NumberOfVisibleWeeks is 6.

    Remarks

    Leading and trailing dates will be considered only when the NumberOfVisibleWeeks is 6. ShowTrailingAndLeadingDates property will not applicable, when NumberOfVisibleWeeks is not 6.

    Examples

    The following code demonstrates, how to use the NumberOfVisibleWeeks property in the calendar

    this.Calendar.MonthView.NumberOfVisibleWeeks = 6;
    See Also
    MonthView

    RangeTextStyle

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

    Declaration
    public CalendarTextStyle RangeTextStyle { get; set; }
    Property Value
    Type Description
    CalendarTextStyle
    Examples

    The following code demonstrates, how to use the RangeTextStyle property in the calendar

    CalendarTextStyle textStyle = new CalendarTextStyle()
    {
        FontSize = 12,
        TextColor = Colors.Red,
    };
    this.Calendar.MonthView.RangeTextStyle = textStyle;
    See Also
    Range
    MonthView
    SelectionBackground

    SelectionTextStyle

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

    Declaration
    public CalendarTextStyle SelectionTextStyle { get; set; }
    Property Value
    Type Description
    CalendarTextStyle
    Examples

    The following code demonstrates, how to use the SelectionTextStyle property in the calendar

    CalendarTextStyle textStyle = new CalendarTextStyle()
    {
        FontSize = 12,
        TextColor = Colors.Red,
    };
    this.Calendar.MonthView.SelectionTextStyle = textStyle;
    See Also
    SelectionMode
    MonthView
    SelectionBackground
    StartRangeSelectionBackground
    EndRangeSelectionBackground

    ShowWeekNumber

    Gets or sets a value indicating whether to displays the week number of the year in the SfCalendar. Week number value calculated based on the full week rule with Monday as first day of week.

    Declaration
    public bool ShowWeekNumber { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value of ShowWeekNumber is false.

    Examples

    The following code demonstrates, how to use the ShowWeekNumber property in the calendar

    this.Calendar.MonthView.ShowWeekNumber = false;
    See Also
    MonthView
    WeekNumberStyle

    SpecialDates

    Gets or sets the special dates collection of the calendar month view.

    Declaration
    public List<DateTime> SpecialDates { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.DateTime>
    Examples

    The following code demonstrates, how to use the SpecialDates property in the calendar

    this.Calendar.MonthView.SpecialDates = new List<DateTime>
    {
    	DateTime.Now.AddDays(2),
        DateTime.Now.AddDays(7),
        DateTime.Now.AddDays(-6),
    };
    See Also
    MonthView
    SpecialDatesBackground
    SpecialDatesTextStyle

    SpecialDatesBackground

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

    Declaration
    public Brush SpecialDatesBackground { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.Brush

    The default value of SpecialDatesBackground is Transparent

    Examples

    The following code demonstrates, how to use the SpecialDatesBackground property in the calendar

    this.Calendar.MonthView.SpecialDatesBackground = Colors.Orange;
    See Also
    MonthView
    SpecialDatesTextStyle

    SpecialDatesTextStyle

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

    Declaration
    public CalendarTextStyle SpecialDatesTextStyle { get; set; }
    Property Value
    Type Description
    CalendarTextStyle
    Examples

    The following code demonstrates, how to use the SpecialDatesTextStyle property in the calendar

    CalendarTextStyle textStyle = new CalendarTextStyle()
    {
        FontSize = 12,
        TextColor = Colors.Red,
    };
    this.Calendar.MonthView.SpecialDatesTextStyle = textStyle;
    See Also
    MonthView
    SpecialDatesBackground

    SpecialDayPredicate

    Gets or sets the function to decide whether the month cell date is a special date or not in the calendar.

    Declaration
    public Func<DateTime, CalendarIconDetails> SpecialDayPredicate { get; set; }
    Property Value
    Type Description
    System.Func<System.DateTime, CalendarIconDetails>
    Examples

    The following code demonstrates, how to use the SpecialDayPredicate function.

     this.calendar.MonthView.SpecialDayPredicate = (date) =>
     {
       if (date.Date == DateTime.Now.AddDays(2).Date)
       {
         CalendarIconDetails iconDetails = new CalendarIconDetails();
         iconDetails.Icon = CalendarIcon.Dot;
         iconDetails.Fill = Colors.Red;
         return iconDetails;
        }
        return null;
     };
    See Also
    SpecialDatesBackground
    SpecialDatesTextStyle

    TextStyle

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

    Declaration
    public CalendarTextStyle TextStyle { get; set; }
    Property Value
    Type Description
    CalendarTextStyle
    Examples

    The following code demonstrates, how to use the TextStyle property in the calendar

    CalendarTextStyle textStyle = new CalendarTextStyle()
    {
        FontSize = 12,
        TextColor = Colors.Red,
    };
    this.Calendar.MonthView.TextStyle = textStyle;
    See Also
    MonthView
    Background

    TodayBackground

    Gets or sets the background for the today month cell of the calendar month view.

    Declaration
    public Brush TodayBackground { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.Brush

    The default value of TodayBackground is Transparent.

    Examples

    The following code demonstrates, how to use the TodayBackground property in the calendar

    this.Calendar.MonthView.TodayBackground = Colors.Pink;
    See Also
    MonthView
    TodayTextStyle

    TodayTextStyle

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

    Declaration
    public CalendarTextStyle TodayTextStyle { get; set; }
    Property Value
    Type Description
    CalendarTextStyle
    Examples

    The following code demonstrates, how to use the TodayTextStyle property in the calendar

    CalendarTextStyle textStyle = new CalendarTextStyle()
    {
        FontSize = 12,
        TextColor = Colors.Red,
    };
    this.Calendar.MonthView.TodayTextStyle = textStyle;
    See Also
    MonthView
    TodayBackground

    TrailingLeadingDatesBackground

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

    Declaration
    public Brush TrailingLeadingDatesBackground { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.Brush
    Examples

    The following code demonstrates, how to use the TrailingLeadingDatesBackground property in the calendar

    this.Calendar.MonthView.TrailingLeadingDatesBackground = Colors.Red;
    See Also
    MonthView
    ShowTrailingAndLeadingDates
    TrailingLeadingDatesTextStyle

    TrailingLeadingDatesTextStyle

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

    Declaration
    public CalendarTextStyle TrailingLeadingDatesTextStyle { get; set; }
    Property Value
    Type Description
    CalendarTextStyle
    Examples

    The following code demonstrates, how to use the TrailingLeadingDatesTextStyle property in the calendar

    CalendarTextStyle textStyle = new CalendarTextStyle()
    {
        FontSize = 12,
        TextColor = Colors.Red,
    };
    this.Calendar.MonthView.TrailingLeadingDatesTextStyle = textStyle;
    See Also
    ShowTrailingAndLeadingDates
    MonthView
    TrailingLeadingDatesBackground

    WeekendDatesBackground

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

    Declaration
    public Brush WeekendDatesBackground { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.Brush

    The default value of WeekendDatesBackground is null

    Remarks

    If the value is null, then the weekend dates are not highlighted.

    Examples

    The following code demonstrates, how to use the WeekendDatesBackground property in the calendar

    this.Calendar.MonthView.WeekendDatesBackground = Colors.PaleVioletRed;
    See Also
    MonthView
    WeekendDatesTextStyle

    WeekendDatesTextStyle

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

    Declaration
    public CalendarTextStyle WeekendDatesTextStyle { get; set; }
    Property Value
    Type Description
    CalendarTextStyle

    The default value of WeekendDatesTextStyle is null.

    Examples

    The following code demonstrates, how to use the WeekendDatesTextStyle property in the calendar

    CalendarTextStyle textStyle = new CalendarTextStyle()
    {
        FontSize = 12,
        TextColor = Colors.Red,
    };
    this.Calendar.MonthView.WeekendDatesTextStyle = textStyle;
    See Also
    MonthView
    WeekendDatesBackground

    WeekendDays

    Gets or sets the weekend days collection of the calendar month view.

    Declaration
    public List<DayOfWeek> WeekendDays { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.DayOfWeek>

    The default value of WeekendDays is empty.

    Examples

    The following code demonstrates, how to use the WeekendDays property in the calendar

    this.Calendar.MonthView.WeekendDays = new List<DayOfWeek>
    {
       DayOfWeek.Sunday,
       DayOfWeek.Saturday,
    };
    See Also
    MonthView
    WeekendDatesBackground
    WeekendDatesTextStyle

    WeekNumberStyle

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

    Declaration
    public CalendarWeekNumberStyle WeekNumberStyle { get; set; }
    Property Value
    Type Description
    CalendarWeekNumberStyle
    Examples

    The following code demonstrates, how to use the WeekNumberStyle property in the calendar

    this.Calendar.MonthView.WeekNumberStyle = new CalendarWeekNumberStyle()
    {
        Background = Colors.Grey,
    };
    See Also
    MonthView
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved