menu

WinUI

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class MonthViewSettings - WinUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class MonthViewSettings

    Represents a class which is used to configure all the properties of MonthView.

    Inheritance
    System.Object
    ViewSettingsBase
    MonthViewSettings
    Implements
    System.IDisposable
    Inherited Members
    ViewSettingsBase.AppointmentTemplate
    ViewSettingsBase.AppointmentTemplateSelector
    ViewSettingsBase.Dispose()
    ViewSettingsBase.ResourceHeaderSize
    ViewSettingsBase.ViewHeaderDayFormat
    ViewSettingsBase.ViewHeaderHeight
    ViewSettingsBase.ViewHeaderTemplate
    ViewSettingsBase.VisibleResourceCount
    Namespace: Syncfusion.UI.Xaml.Scheduler
    Assembly: Syncfusion.Scheduler.WinUI.dll
    Syntax
    public class MonthViewSettings : ViewSettingsBase, IDisposable

    Constructors

    MonthViewSettings()

    Initializes a new instance of the MonthViewSettings class.

    Declaration
    public MonthViewSettings()

    Properties

    AgendaViewHeight

    Gets or sets the Agenda view height.

    Declaration
    public double AgendaViewHeight { get; set; }
    Property Value
    Type
    System.Double

    AppointmentDisplayCount

    Gets or sets a value to define the maximum number of the appointment to be displayed in a month cell.

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

    This property takes the AppointmentDisplayCount value. For AppointmentDisplayCount value is 1 and month cell have more than 1 appointments, single appointment will be displayed and remaining appointments in month cell displayed in more appointments count. If an AppointmentDisplayCount value is more than one, for an example value is 3 and month cell have more than 3 appointments, 2 appointments will be displayed and remaining appointments in month cell displayed in more appointments count.

    AppointmentDisplayMode

    Gets or sets a value which define the display mode for appointment in month view.

    Declaration
    public AppointmentDisplayMode AppointmentDisplayMode { get; set; }
    Property Value
    Type
    AppointmentDisplayMode

    CellRightPadding

    Gets or sets the option to include spacing between a cell's appointment and its border on the right side to interact with a scheduler cell that contains appointments.

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

    The default value is 10.

    Remarks

    This property is applicable only when the ItemsSource property is enabled or when appointments are present in the scheduler.

    Examples

    #C#

    this.scheduler.MonthViewSettings.CellRightPadding = 5;

    #Xaml

    <scheduler:SfScheduler x:Name="scheduler">
       <scheduler:SfScheduler.MonthViewSettings>
           <scheduler:MonthViewSettings CellRightPadding = "5" />
       </scheduler:SfScheduler.MonthViewSettings>
    </scheduler:SfScheduler>

    DateFormat

    Gets or sets a date format.

    Declaration
    public string DateFormat { get; set; }
    Property Value
    Type
    System.String
    Examples

    The following sample used to set the date format.

    #[C#](#tab/tabid-1)
    this.Schedule.MonthViewSettings.DateFormat = "%d"
    #[Xaml](#tab/tabid-2)
    <?xml version = "1.0" encoding="utf-8"?>
    <syncfusion:SfScheduler x:Name="Schedule" >
       <syncfusion:SfScheduler.MonthViewSettings>
           <syncfusion:MonthViewSettings DateFormat = "%d" />
      </ syncfusion:SfScheduler.MonthViewSettings>
    </syncfusion:SfScheduler>

    LeadingDaysVisibility

    Gets or sets a value indicating whether leading days should be visible or not.

    Declaration
    public Visibility LeadingDaysVisibility { get; set; }
    Property Value
    Type
    Microsoft.UI.Xaml.Visibility

    MonthCellTemplate

    Gets or sets the month cell template.

    Declaration
    public DataTemplate MonthCellTemplate { get; set; }
    Property Value
    Type
    Microsoft.UI.Xaml.DataTemplate
    Examples

    The following sample used to configure month cell.

    #[Xaml](#tab/tabid-4)
    <syncfusion:SfScheduler x:Name="Schedule">
       <syncfusion:SfScheduler.MonthViewSettings>
           <syncfusion:MonthViewSettings>
               <syncfusion:MonthViewSettings.MonthCellTemplate>
                   <DataTemplate>
                      <Border Background = "BlueViolet" >
                        < TextBlock x:Name="DayText" HorizontalAlignment="Center"
                                  Foreground="White" Text="{Binding DateTime.Day}"/>
                      </Border>
                   </DataTemplate>
               </syncfusion:MonthViewSettings.MonthCellTemplate>
           </syncfusion:MonthViewSettings>
      </syncfusion:SfScheduler.MonthViewSettings>
    </syncfusion:SfScheduler>

    MonthCellTemplateSelector

    Gets or sets the month cell template selector.

    Declaration
    public DataTemplateSelector MonthCellTemplateSelector { get; set; }
    Property Value
    Type
    Microsoft.UI.Xaml.Controls.DataTemplateSelector
    Examples

    The following sample used to configure month cell template selector.

    #[DataTemplateSelector](#tab/tabid-5)
    public class MonthCellTemplateSelector : DataTemplateSelector
    {
    public MonthCellTemplateSelector()
    {
    }
    public DataTemplate NormalDayMonthCellTemplate { get; set; }
    public DataTemplate CurrentDayMonthCellTemplate { get; set; }
    protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
    {
      var monthCell = container as MonthCell;
      if (monthCell != null)
      {
          if (monthCell.DateTime.Date == DateTime.Now.Date)
              return CurrentDayMonthCellTemplate;
       }
       return NormalDayMonthCellTemplate;
    }
    }
    #[Resources](#tab/tabid-6)
    <Window.Resources>
          <DataTemplate x:Key="monthCellTemplate1">
           <Border Background = "BlueViolet" >
               < TextBlock x:Name="DayText" HorizontalAlignment="Center" Foreground="White" Text="{Binding DateTime.Day}"/>
           </Border>
       </DataTemplate>
      <DataTemplate x:Key="monthCellTemplate2">
          <Border Background = "LightCyan" >
               < TextBlock x:Name="DayText" HorizontalAlignment="Center" Foreground="Red" Text="{Binding DateTime.Day}"/>
           </Border>
       </DataTemplate>
      <local:MonthCellTemplateSelector x:Key="monthCellTemplateSelector"
      NormalDayMonthCellTemplate="{StaticResource monthCellTemplate1}"
      CurrentDayMonthCellTemplate="{StaticResource monthCellTemplate2}" />
    </Window.Resources>
    #[MainWindow](#tab/tabid-7)
    <syncfusion:SfScheduler x:Name="schedule">
           <syncfusion:SfScheduler.MonthViewSettings>
               <syncfusion:MonthViewSettings MonthCellTemplateSelector = "{StaticResource monthCellTemplateSelector}" />
           </ syncfusion:SfScheduler.MonthViewSettings>
    </syncfusion:SfScheduler>

    MonthNavigationDirection

    Gets or sets a value which determines in which direction the MonthView scrolls.

    Declaration
    public Orientation MonthNavigationDirection { get; set; }
    Property Value
    Type
    Microsoft.UI.Xaml.Controls.Orientation

    MoreAppointmentsIndicatorTemplate

    Gets or sets the template for changing the default UI of the scheduler month view's more appointments indicator view in the month cell.

    Declaration
    public DataTemplate MoreAppointmentsIndicatorTemplate { get; set; }
    Property Value
    Type
    Microsoft.UI.Xaml.DataTemplate
    Remarks

    The DataContext of the MoreAppointmentsIndicatorTemplate is an integer that denotes count of appointments not in view.

    Examples

    The following sample used to configure the more appointments indicator template.

    #[C#](#tab/tabid-8)
    var scheduleAppointments = new ScheduleAppointmentCollection();
    for (int i = 0; i < 5; i++)
    {
      var scheduleAppointment = new ScheduleAppointment()
      {
          Subject = "General Meeting",
          StartTime = new DateTime(2021, 04, 30, 09, 0, 0),
          EndTime = new DateTime(2021, 04, 30, 10, 0, 0),
          AppointmentBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFA2C139")),
          IsAllDay = true,
      };
      scheduleAppointments.Add(scheduleAppointment);
    }
    this.Schedule.ItemsSource = scheduleAppointments;
    #[Xaml](#tab/tabid-9)
    <syncfusion:SfScheduler x:Name="Schedule">
    <syncfusion:SfScheduler.MonthViewSettings >
        <syncfusion:MonthViewSettings >
             <syncfusion:MonthViewSettings.MoreAppointmentsIndicatorTemplate >
                 <DataTemplate>
                     <StackPanel Background="LightBlue" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                        <TextBlock Text="{Binding}" Foreground="Black" TextAlignment="Left" VerticalAlignment="Center">
                         </TextBlock>
                   </StackPanel>
               </DataTemplate>
                   </ syncfusion:MonthViewSettings.MoreAppointmentsIndicatorTemplate >
                </ syncfusion:MonthViewSettings >
             </ syncfusion:SfScheduler.MonthViewSettings >
     </syncfusion:SfScheduler>

    NumberOfVisibleWeeks

    Gets or sets the value to customize the number of rows displayed in the month view of the scheduler.

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

    The default value is 6, with a valid range of 1 to 6.

    Remarks

    The LeadingDaysVisibility and TrailingDaysVisibility properties are applicable only when the number of visible weeks is set to 6. The number of visible weeks value ranges from 1 to 6. If the value is greater than 6, it will be considered 6. If the value is less than 1, it will be considered 1.

    Examples

    The below examples shows, how to use the NumberOfVisibleWeeks property of MonthViewSettings in the SfScheduler.

    • XAML
    • C#
     <schedule:SfScheduler x:Name="scheduler"
                           ViewType="Month">
       <schedule:SfScheduler.MonthViewSettings>
           <schedule:MonthViewSettings NumberOfVisibleWeeks="3"/>
       </schedule:SfScheduler.MonthViewSettings>
    </schedule:SfScheduler>
    this.scheduler.ViewType = SchedulerViewType.Month;
    this.scheduler.MonthViewSettings.NumberOfVisibleWeeks = 3;

    ShowAgendaView

    Gets or sets a value indicating whether agenda view should be visible or not.

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

    ShowWeekNumber

    Gets or sets a value indicating whether week number should be shown or not.

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

    TrailingDaysVisibility

    Gets or sets a value indicating whether trailing days should be visible or not.

    Declaration
    public Visibility TrailingDaysVisibility { get; set; }
    Property Value
    Type
    Microsoft.UI.Xaml.Visibility

    WeekNumberTemplate

    Gets or sets the week number template.

    Declaration
    public DataTemplate WeekNumberTemplate { get; set; }
    Property Value
    Type
    Microsoft.UI.Xaml.DataTemplate
    Examples

    The following sample used to configure the week number template.

    #[Xaml](#tab/tabid-3)
    <syncfusion:SfScheduler x:Name="Schedule">
       <syncfusion:SfScheduler.MonthViewSettings>
           <syncfusion:MonthViewSettings>
               <syncfusion:MonthViewSettings.WeekNumberTemplate>
                  <DataTemplate>
                       <Grid >
                           <TextBlock Foreground = "Red" Text="{Binding}"
                                      VerticalAlignment="Center" HorizontalAlignment="Center"/>
                       </Grid>
                   </DataTemplate>
               </syncfusion:MonthViewSettings.WeekNumberTemplate>
           </syncfusion:MonthViewSettings>
      </syncfusion:SfScheduler.MonthViewSettings>
    </syncfusion:SfScheduler>

    Methods

    Dispose(Boolean)

    Disposes all the resources used by the MonthViewSettings class.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    Indicates whether the call is from Dispose method or from a System.GC.SuppressFinalize(System.Object).

    Overrides
    ViewSettingsBase.Dispose(Boolean)

    Implements

    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved