Skip to main content

Calendar Class

NuGet: GHIElectronics.TinyCLR.UI
Assembly: GHIElectronics.TinyCLR.UI
Namespace: GHIElectronics.TinyCLR.UI.Controls

A month calendar: a header with prev/next month arrows, a day-of-week row, and a grid of day cells. Tapping the arrows changes the month; tapping a day selects it.

public class Calendar : Control

Constructors

Calendar()

public Calendar()

Creates a calendar showing the current month.

Properties

ForeColor

public Color ForeColor { get; set; }

Colour of the day / header text.

SelectionColor

public Color SelectionColor { get; set; }

Fill behind the selected day.

Year

public int Year { get; set; }

The displayed year.

Month

public int Month { get; set; }

The displayed month (1-12).

SelectedDay

public int SelectedDay { get; set; }

The selected day of month (0 = none).

Methods

MeasureOverride(int availableWidth, int availableHeight, out int desiredWidth, out int desiredHeight)

protected override void MeasureOverride(int availableWidth, int availableHeight, out int desiredWidth, out int desiredHeight)

Reports the full grid height (header + day-of-week row + 6 week rows).

OnTouchUp(TouchEventArgs e)

protected override void OnTouchUp(TouchEventArgs e)

Handles taps on the prev/next arrows and the day cells.

OnRender(DrawingContext dc)

public override void OnRender(DrawingContext dc)

Draws the header, weekday initials, and the day grid.