Search
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
Assembly: MindFusion.Scheduling

 Syntax

C#  Copy Code

public List<DateStyle> MonthStyles { get; }

Visual Basic  Copy Code

Public ReadOnly Property MonthStyles As List(Of DateStyle)

 Property Value

A list of DateStyle objects.

 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#  Copy Code

// 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(
        Colors.LightSteelBlue, Colors.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  Copy Code

' 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( _
        Colors.LightSteelBlue, Colors.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