The background, border brush and border thickness of a range of time slots for single day in Day or Week Calendar views can be customized. Here is a screen shot of the time slots for Tuesday beginning at 8:00am customized to be yellow background and orange borders:



Note: Slot height is kept constant and cannot be changed for individual slots. The slot height is defined by the static property TimeSlotHeight of class ScheduleSettings (DevComponents.Silverlight.Schedule). It has a default value of 23 pixels which can be changed in code.

Customizations are defined via the ViewCustomizations Dependency Property of the CalendarView control. ViewCustomizations is a property of type CalendarViewCustomizations, which in turn has three properties for customizing different aspects of the calendar’s view: GlobalAppointmentViewDefinitions, DayTimeSlotAppearances, and MonthDayAppearances. For customizing time slots in Day and Week view, we define a value for DayTimeSlotAppearances. DayTimeSlotAppearances is an ObservableCollection of TimeSlotAppearanceGroup which in turn is a collection of TimeSlotAppearance.

Specific time slot customizations are defined with instances of TimeSlotAppearance. TimeSlotAppearance is a DependencyObject with the following dependency properties:

  • Background – A Brush to use for time slot backgrounds.
  • BorderBrush – A Brush to use for time slot borders.
  • BorderThickness – A Thickness for the borders of the time slots. Note: The default thickness has value of 1 for bottom and 0 for the other three sides.
  • TimeRange – A TimeRange object that specifies the start and end times for the customization. A TimeRange can be defined in Xaml with a string in the form: "8, 0, 12, 0" indicating start hour, start minute, end hour and end minute.

TimeSlotAppearance instances are grouped according to the date on which they apply, using DayTimeSlotAppearanceGroup. DayTimeSlotAppearanceGroup is a DependencyCollection (a DependencyObject which implements IList, IList<T> and INotifyCollectionChanged) DayTimeSlotAppearanceGroup exposes the following dependency properties:

  • Date – A nullable DateTime specifying the specific date which the contained customizations are to be applied. Note that only the Date portion of the DateTime value is used.
  • DayOfWeek – a nullable DayOfWeek enumeration value specifying a repeating day of the week the customizations are to be applied.
  • RecurrencePattern – an instance of class RecurrencePattern specifying a more complex recurrence.
  • OwnerKey – the key of the specific owner for which the customizations are to be applied. The default value is null, which indicates the default owner.

A value for one, but not all three, of Date, DayOfWeek or RecurrencePattern is required.

Use the OwnerKey property to indicate a specific owner for the customizations.

RecurrancePattern is a class for defining simple recurrences. Specify whether the recurrence is daily, weekly, monthly or yearly with the PatternType property. If daily or weekly, specific days are specified using DaysOfWeek property, which is an enum that has Flags attribute set so values can be or’d together. If monthly, a value for StartDate alone indicates a repeating day of the month (i.e. every 23rd day.) Use RelativeDayInMonth to specify whether the repeating day is the first, second, third, fourth or last day of the month. If StartDate is supplied, then day of week is inferred from it. Otherwise, use DaysOfWeek property to specify the specific day or days which are recurring.

Here is an example of time slot customizations defined in Xaml. Here, a custom time slot appearance is defined with Background Lightgreen and BorderBrush Green for time slots between 3:00 and 5:00 and owner "don" to be repeated every Friday.

<schedule:CalendarViewCustomizations x:Key="CalendarCustomizations">
            <schedule:DayTimeSlotAppearanceGroup DayOfWeek="Friday" OwnerKey="don">
                <schedule:TimeSlotAppearance TimeRange="15,0,17,0" Background="Lightgreen" BorderBrush="Green" />

This customization is applied to the CalendarView by setting ViewCustomizations property as such:

ViewCustomizations="{StaticResource CalendarViewCustomizations}"