Table of Contents

Class Calendar

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

The calendar control allows the user to pick a date.

[ControlCategory("Other")]
public class Calendar : CustomDateEdit, IBaseObjectWithId, IDisposableObject, IBaseObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, INotifyDataErrorInfo
Inheritance
Calendar
Implements

Remarks

Examples of how a Calendar can look on different platforms:

Constructors

Calendar()

Initializes a new instance of the Calendar class.

Calendar(Control)

Initializes a new instance of the Calendar class.

Fields

DefaultSequentalMonthSelect

Gets or sets default value for the SequentalMonthSelect property. Default is True.

DefaultShowHolidays

Gets or sets default value for the ShowHolidays property. Default is True.

DefaultShowWeekNumbers

Gets or sets default value for the ShowWeekNumbers property. Default is False.

DefaultUseGeneric

Gets or sets whether to use generic or native platform calendar by default. Default is True.

SetThemeWhenHandleCreated

Gets or sets whether to apply theme colors after native calendar control is created (true) or to use the default colors (false). Default is True.

Properties

BackgroundColor

Gets or sets the background color for the control.

ControlKind

Returns control identifier.

FirstDayOfWeek

Gets or sets the day that is considered the beginning of the week.

Font

Gets or sets the font of the text displayed by the control.

ForegroundColor

Gets or sets the foreground color for the control.

HasBorder

Gets or sets a value indicating whether the control has a border.

HeaderColorBg

Gets or sets the background color of the header part of the calendar control.

HeaderColorFg

Gets or sets the foreground color of the header part of the calendar control.

HighlightColorBg

Gets or sets the background highlight color.

HighlightColorFg

Gets or sets the foreground highlight color.

HolidayColorBg

Gets or sets the background color currently used for holiday highlighting.

HolidayColorFg

Gets or sets the foreground color currently used for holiday highlighting.

IsBold

Gets or sets whether font style override is bold.

MarkDateAttr

Gets or sets the ICalendarDateAttr attributes for the marked days.

NoMonthChange

Gets or sets a value indicating whether to disable the month (and, implicitly, the year) changing. Not implemented on all platforms.

SequentalMonthSelect

Gets or sets a value indicating whether to use alternative, more compact, style for the month and year selection controls.

ShowHolidays

Gets or sets a value indicating whether to highlight holidays in the calendar

ShowSurroundWeeks

Gets or sets a value indicating whether to show the neighbouring weeks in the previous and next months. (only generic, always on for the native controls)

ShowWeekNumbers

Gets or sets a value indicating whether to show week numbers on the left side of the calendar.

UseGeneric

Gets or sets a value indicating whether to use generic calendar or native calendar.

Value

Gets or sets the currently selected date.

Methods

CreateDateAttr(CalendarDateBorder)

Creates ICalendarDateAttr instance.

CreateHandler()

Creates a handler for the control.

GetAttr(int)

Returns the ICalendarDateAttr attributes for the given day or null.

HitTest(PointD)

Returns one of Calendar.HitTestResult constants.

Mark(int, bool)

Marks or unmarks the day.

MarkAll(bool)

Marks or unmarks all days in the month.

OnDayDoubleClick(EventArgs)

Called when a day was double clicked in the calendar.

OnDayHeaderClick(EventArgs)

Called when the user clicked on the week day header (fired only in generic calendar).

OnHandleCreated(EventArgs)

Called when the conrol's handle is created.

OnPageChanged(EventArgs)

Called when the selected month (and/or year) changed.

OnSelectionChanged(EventArgs)

Called when the selected date changed.

OnWeekNumberClick(EventArgs)

Called when the user clicked on the week of the year number (fired only in generic calendar).

RaiseDayDoubleClick(EventArgs)

Raises DayDoubleClick event and calls OnDayDoubleClick(EventArgs) method.

RaiseDayHeaderClick(EventArgs)

Raises DayHeaderClick event and calls OnDayHeaderClick(EventArgs) method.

RaisePageChanged(EventArgs)

Raises PageChanged event and calls OnPageChanged(EventArgs) method.

RaiseSelectionChanged(EventArgs)

Raises SelectionChanged event and calls OnSelectionChanged(EventArgs) method

RaiseWeekNumberClick(EventArgs)

Raises WeekNumberClick event and calls OnWeekNumberClick(EventArgs) method.

ResetAttr(int)

Clears any attributes associated with the given day.

ResetAttrAll()

Clears any attributes associated with the days.

SelectToday()

Changes Value property to the today date.

SetAttr(int, ICalendarDateAttr?)

Sets the ICalendarDateAttr attributes for the given day.

SetColorThemeToAuto()

Sets colors used in the control to the auto theme (takes colors from the system colors).

SetColorThemeToLight()

Sets colors used in the control to the light theme.

SetHeaderColors(Color, Color)

Sets values for HeaderColorBg and HeaderColorFg properties.

SetHighlightColors(Color, Color)

Sets values for HighlightColorBg and HighlightColorFg properties.

SetHoliday(int)

Marks the specified day as being a holiday in the current month.

SetHolidayColors(Color, Color)

Sets values for HolidayColorBg and HolidayColorFg properties.

SetRange(DateTime, DateTime)

Sets possible date range in the native control.

UpdateThemeIfRequired()

Called from constructor and after handle is created. Updates theme colors if SetThemeWhenHandleCreated is True.

Events

DayDoubleClick

Occurs when a day was double clicked in the calendar.

DayHeaderClick

Occurs when the user clicked on the week day header (fired only in generic calendar).

PageChanged

Occurs when the selected month (and/or year) changed.

SelectionChanged

Occurs when the selected date changed.

WeekNumberClick

Occurs when the user clicked on the week of the year number (fired only in generic calendar).