PocketPlanner Programmer's Guide

Calendar.MonthStyles Property

See Also

Gets a collection of DateStyle objects that allow customizing the appearance of specific months in the calendar.

Namespace: MindFusion.Scheduling.Compact
Assembly: PocketPlanner

 Syntax

C#

public DateStyleCollection MonthStyles { get; }

Visual Basic

Public ReadOnly Property MonthStyles As DateStyleCollection

 Property Value

An instance of the DateStyleCollection class.

 Remarks

Use this collection to assign a distinct style to a month or a range of months, overriding the default style of the current view. If there are several styles defined for the same month, the one with highest Priority is used.

 Example

The following example creates a custom style for the current month. The example assumes that calendar references existing Calendar control.

C#

// Create the custom date style
DateStyle dateStyle = new DateStyle();

// Change the brush used to fill the header contents
dateStyle.Style.HeaderBrush =
    new MindFusion.Drawing.LinearGradientBrush(
        Color.LightSteelBlue, Color.SteelBlue, 90);

// Set the time range of the style to span the whole month
DateTime today = DateTime.Today;
dateStyle.From = new DateTime(today.Year, today.Month, 1);
dateStyle.To = new DateTime(today.Year, today.Month,
    DateTime.DaysInMonth(today.Year, today.Month));

// Add the style
calendar.MonthStyles.Add(dateStyle);

Visual Basic

' Create the custom date style
Dim dateStyle As New DateStyle()

' Change the brush used to fill the header contents
dateStyle.Style.HeaderBrush = _
    New MindFusion.Drawing.LinearGradientBrush( _
        Color.LightSteelBlue, Color.SteelBlue, 90)

' Set the time range of the style to span the whole month
Dim today As DateTime = DateTime.Today
dateStyle.From = New DateTime(today.Year, today.Month, 1)
dateStyle.To = New DateTime(today.Year, today.Month, _
    DateTime.DaysInMonth(today.Year, today.Month))

' Add the style
calendar.MonthStyles.Add(dateStyle)

 See Also