Some people want to display the number of appointments in a day of the month view instead of the appointments themselves. The way to achieve this is by overriding the default content template that is used for a a day of the month. This is done by defining a DataTemplate resource and assigning it a Key value of ‘DefaultMonthDayViewContentTemplate’. The day’s appointment is accessible via the AppointmentCount property of the object which is assigned as the control’s Content. For example, the following data template will preserve existing behavior plus add appointment count to the display of a day:

<ctrls:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<local:AppointmentCountToStringConverter x:Key="AppointmentCountToStringConverter" />
<DataTemplate x:Key="DefaultMonthDayViewContentTemplate">
        <Border Visibility="{Binding IsActive, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=Inverse}" 
               ctrls:DynamicResource.BackgroundKey="MonthWeekInactiveDayBackground" />
        <Border Visibility="{Binding IsSelected, Converter={StaticResource BoolToVisibilityConverter}}" 
               ctrls:DynamicResource.BackgroundKey="MonthWeekSelectionBackground" />
        <Border BorderThickness="0,0,1,1" ctrls:DynamicResource.BorderBrushKey="MonthWeekDayBorder" />
        <TextBlock Margin="5,2" Text="{Binding AppointmentCount, Converter={StaticResource AppointmentCountToStringConverter}}" />


Notice that the binding of the TextBlock’s Text property to AppointmentCount is using a value converter to convert the raw number into the string to display. Here is sample code for one possible value converter:

public class AppointmentCountToStringConverter : IValueConverter
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        var count = (int)value;
        return count == 0 ? null : String.Format("{0} appointments", count);

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        throw new NotImplementedException();


Finally, you will probably want turn off the showing of appointments when the month view is active, or the appointments will cover up the text. For this, use the CalendarView’s ShowAppointments property. ShowAppointments affects all view types, not just the month view, so you will need to set its value depending on what view is currently active. This could be done in a handler for the CalendarView.SelectedViewChanged event, by binding the CalendarView’s ShowAppointments property to its SelectedViewType property and including a value converter, or through a view model. Following is an example of the first. Assume that there is an instance of CalendarView control named Calendar:

Calendar.SelectedViewChanged += delegate
    Calendar.ShowAppointments = Calendar.SelectedViewType != CalendarViewType.Month;

Related posts:

  1. Customizing Month View Days in Silverlight Schedule
  2. Customizing Appointment Views in Silverlight Schedule
  3. Customizing Time Slots in Silverlight Schedule
  4. Silverlight Schedule Control Quick Start Guide
  5. Schedule Control Quick Start Guide (Silverlight)