HeaderPane
Main
Hide
Share Link
Print

CalendarClass Class

An instance of the CalendarClass class defines the layout, behavior and appearance of a calendar.

The SftCalendar control and the dropdown of the SftDate control use the settings of their SftDate.Calendar property. All colors default to Color.Empty, which selects a color that follows the control's dark mode and high contrast settings.

Namespace: Softelvdm.SftDateNET
Assembly: Softelvdm.SftDateNET

Inheritance

Syntax

public class CalendarClass : System.ComponentModel.INotifyPropertyChanged;
Public Class CalendarClass
    Implements System.ComponentModel.INotifyPropertyChanged

Constructors

This class cannot be instantiated.

Properties

PublicAllowedViewsDefines the views the user can switch to.
PublicBackColorDefines the background color.
PublicBorderColorDefines the color of the line below the names of the days of the week.
PublicClearTextDefines the text of the Clear button.
PublicDayOfWeekForeColorDefines the color of the names of the days of the week.
PublicDisabledDaysOfWeekDefines the days of the week that cannot be selected.
PublicDisabledForeColorDefines the color of days that cannot be selected.
PublicFirstDayOfWeekDefines the first day of the week.
PublicFontDefines the font of the days.
PublicForeColorDefines the color of the days.
PublicHighlightTodayDefines whether today's date is highlighted.
PublicHotBackColorDefines the background color of the day under the mouse.
PublicInitialViewDefines the view the calendar starts with.
PublicMaxRangeDaysDefines the largest number of days a range can include.
PublicMonthsAcrossDefines the number of months shown side by side.
PublicMonthsDownDefines the number of months shown one below the other.
PublicRangeBackColorDefines the background color of the days between the first and last day of a range.
PublicScrollMonthsDefines the number of months the previous and next buttons scroll.
PublicSelectedBackColorDefines the background color of selected days.
PublicSelectedForeColorDefines the text color of selected days.
PublicShowClearButtonDefines whether the Clear button is shown below the calendar.
PublicShowTodayButtonDefines whether the Today button is shown below the calendar.
PublicShowTrailingDatesDefines whether the days of the previous and next month are shown before and after a month.
PublicShowWeekNumbersDefines whether week numbers are shown.
PublicSpecialDatesReturns the collection of special dates.
PublicTitleBackColorDefines the background color of the titles.
PublicTitleFontDefines the font of the titles.
PublicTitleForeColorDefines the text color of the titles and the navigation buttons.
PublicTodayColorDefines the color that marks today's date.
PublicTodayDateDefines the date the calendar treats as today.
PublicTodayTextDefines the text of the Today button.
PublicTrailingForeColorDefines the color of the days of the previous and next month.
PublicWeekendForeColorDefines the color of Saturdays and Sundays.
PublicWeekNumberBackColorDefines the background color of the week numbers.
PublicWeekNumberForeColorDefines the color of the week numbers.
PublicWeekNumberRuleDefines how week numbers are calculated.

Methods

PublicInherited from System.ObjectEqualsDetermines whether the specified object is equal to the current object.
ProtectedInherited from System.ObjectFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
PublicInherited from System.ObjectGetHashCodeServes as the default hash function.
PublicInherited from System.ObjectGetTypeGets the Type of the current instance.
ProtectedInherited from System.ObjectMemberwiseCloneCreates a shallow copy of the current Object.
PublicStaticInherited from System.ObjectReferenceEqualsDetermines whether the specified Object instances are the same instance.
PublicToStringReturns a string that represents the object.

Events

PublicPropertyChangedOccurs when a property of the calendar settings changes.

Examples

C# View entire sample code

        private void FillCombo(ComboBox combo, Type enumType, object current) {
            foreach (object value in Enum.GetValues(enumType))
                combo.Items.Add(value);
            combo.SelectedItem = current;
        }

        // The options apply to all fields and the calendar; a field's Calendar property defines its dropdown calendar.
        private void ForEachCalendar(Action<CalendarClass> action) {
            foreach (SftDate field in fields)
                action(field.Calendar);
            action(sftCalendar1.Calendar);
        }

        private CultureInfo SelectedCulture() {
            CultureInfo culture;
            switch (comboCulture.SelectedIndex) {

VB.NET View entire sample code

    Private Sub FillCombo(ByVal combo As ComboBox, ByVal enumType As Type, ByVal current As Object)
        For Each value As Object In [Enum].GetValues(enumType)
            combo.Items.Add(value)
        Next
        combo.SelectedItem = current
    End Sub

    ' The options apply to all fields and the calendar; a field's Calendar property defines its dropdown calendar.
    Private Iterator Function AllCalendars() As IEnumerable(Of CalendarClass)
        ' Handles clauses run while InitializeComponent sets the designer values, before the constructor fills fields
        If fields Is Nothing Then Return
        For Each field As SftDate In fields
            Yield field.Calendar
        Next
        Yield SftCalendar1.Calendar
    End Function

See Also Classes | SftDate/NET 3.0