MonthCalendar Class
Represents a month calendar control.
public class MonthCalendar : Control, DUCE.IResource, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IHaveResources, IQueryAmbient
- Inheritance:
- Object DispatcherObject DependencyObject Visual UIElement FrameworkElement Control Object
Constructors
MonthCalendar()
Initializes a new instance of the MonthCalendar class.
public MonthCalendar()
Properties
ActiveDate
Gets or sets the active date in the calendar.
ActiveViewMode
Gets or sets the active view mode of the calendar.
public MonthCalendarViewMode ActiveViewMode { get; set; }
Property Value
- MonthCalendarViewMode:
The active view mode of the calendar. The default value is
MonthCalendarViewMode.Month
.
CalendarWeekRule
Gets or sets the calendar week rule, which determines how weeks are numbered.
public CalendarWeekRule? CalendarWeekRule { get; set; }
Property Value
- Nullable<CalendarWeekRule>:
The calendar week rule. When set to null, the calendar week rule is pulled from the current culture. The default value is null.
CanRetainTime
Gets or sets whether the various DateTime values can retain the time-portion, or if it is reset to midnight.
public bool CanRetainTime { get; set; }
Property Value
ClearButtonStyle
Gets or sets the Style to apply to the Clear button.
public Style ClearButtonStyle { get; set; }
Property Value
ClearButtonText
Gets or sets the text to display in the Clear button.
public string ClearButtonText { get; set; }
Property Value
- String:
The text to display in the Clear button.
ClearSelectionCommand
Gets the ICommand that is used to clear the selection.
public ICommand ClearSelectionCommand { get; }
Property Value
DayItemsPanelTemplate
Gets or sets the ItemsPanelTemplate to use for arranging day items.
public ItemsPanelTemplate DayItemsPanelTemplate { get; set; }
Property Value
- ItemsPanelTemplate:
The ItemsPanelTemplate to use for arranging day items.
DayItemTemplate
Gets or sets the DataTemplate to use for day items.
public DataTemplate DayItemTemplate { get; set; }
Property Value
- DataTemplate:
The DataTemplate to use for day items.
DayItemTemplateSelector
Gets or sets the DataTemplateSelector to use for day items.
public DataTemplateSelector DayItemTemplateSelector { get; set; }
Property Value
- DataTemplateSelector:
The DataTemplateSelector to use for day items.
DayNameItemContainerStyle
Gets or sets the Style to apply to day name items.
public Style DayNameItemContainerStyle { get; set; }
Property Value
DayNameItemsPanelTemplate
Gets or sets the ItemsPanelTemplate to use for arranging day name items.
public ItemsPanelTemplate DayNameItemsPanelTemplate { get; set; }
Property Value
- ItemsPanelTemplate:
The ItemsPanelTemplate to use for arranging day name items.
DayNameItemTemplate
Gets or sets the DataTemplate to use for day name items.
public DataTemplate DayNameItemTemplate { get; set; }
Property Value
- DataTemplate:
The DataTemplate to use for day name items.
DayOfWeekFormatPattern
Gets or sets the format pattern used for DayOfWeek values.
public DayOfWeekFormatPattern DayOfWeekFormatPattern { get; set; }
Property Value
- DayOfWeekFormatPattern:
The format pattern used for DayOfWeek values. The default value is
DayOfWeekFormatPattern.AbbreviatedUppercase
.
DecadeItemsPanelTemplate
Gets or sets the ItemsPanelTemplate to use for arranging decade items.
public ItemsPanelTemplate DecadeItemsPanelTemplate { get; set; }
Property Value
- ItemsPanelTemplate:
The ItemsPanelTemplate to use for arranging decade items.
DecadeItemTemplate
Gets or sets the DataTemplate to use for decade items.
public DataTemplate DecadeItemTemplate { get; set; }
Property Value
- DataTemplate:
The DataTemplate to use for decade items.
DisabledDaysOfWeek
Gets or sets the disabled days of the week.
public DaysOfWeek DisabledDaysOfWeek { get; set; }
Property Value
- DaysOfWeek:
The disabled days of the week. The default value is
DaysOfWeek.None
.
FirstDayOfWeek
Gets or sets the first day of the week.
public DayOfWeek? FirstDayOfWeek { get; set; }
Property Value
GoToNextViewCommand
Gets the ICommand that is used to go to the next view.
public ICommand GoToNextViewCommand { get; }
Property Value
GoToPreviousViewCommand
Gets the ICommand that is used to go to the next view.
public ICommand GoToPreviousViewCommand { get; }
Property Value
IsClearButtonVisible
Gets or sets whether the clear button is visible.
public bool IsClearButtonVisible { get; set; }
Property Value
- Boolean:
true
if the clear button is visible; otherwisefalse
. The default value isfalse
.
IsDateDisabledFunc
Gets or sets a function that is called when a day cell is rendered to determine if it should be disabled.
public Func<DateTime, bool> IsDateDisabledFunc { get; set; }
Property Value
- Func<DateTime, Boolean>:
A function that is called when a day cell is rendered to determine if it should be disabled.
Remarks
This function is not called for dates that are outside of the Minimum and Maximum range, nor for dates that are disabled by the DisabledDaysOfWeek property.
IsDayOfWeekSelectionEnabled
Gets or sets whether the day of week headers can be used to select dates.
public bool IsDayOfWeekSelectionEnabled { get; set; }
Property Value
- Boolean:
true
if the day of week headers can be used to select dates; otherwisefalse
. The default value istrue
.
IsTodayButtonVisible
Gets or sets whether the Today button is visible.
public bool IsTodayButtonVisible { get; set; }
Property Value
- Boolean:
true
if the Today button is visible; otherwisefalse
. The default value istrue
.
IsTodayHighlighted
Gets or sets whether DateTime.Today
is highlighted.
public bool IsTodayHighlighted { get; set; }
Property Value
- Boolean:
true
ifDateTime.Today
is highlighted; otherwisefalse
. The default value istrue
.
IsWeekNumberColumnVisible
Gets or sets whether the week number column is visible.
public bool IsWeekNumberColumnVisible { get; set; }
Property Value
- Boolean:
true
if the week number column is visible; otherwisefalse
. The default value isfalse
.
IsWeekNumberSelectionEnabled
Gets or sets whether the week numbers can be used to select dates.
public bool IsWeekNumberSelectionEnabled { get; set; }
Property Value
- Boolean:
true
if the week numbers can be used to select dates; otherwisefalse
. The default value istrue
.
Maximum
Gets or sets the highest possible value.
MaxSelectionCount
Gets or sets the maximum number of dates that can be selected.
public int MaxSelectionCount { get; set; }
Property Value
- Int32:
The maximum number of dates that can be selected. The default value is
-1
, which indicates no upper limit.
MaxViewMode
Gets or sets the maximum view mode allowed.
public MonthCalendarViewMode MaxViewMode { get; set; }
Property Value
- MonthCalendarViewMode:
The maximum view mode allowed. The default value is
MonthCalendarViewMode.Century
.
See Also
Minimum
Gets or sets the lowest possible value.
MonthItemsPanelTemplate
Gets or sets the ItemsPanelTemplate to use for arranging month items.
public ItemsPanelTemplate MonthItemsPanelTemplate { get; set; }
Property Value
- ItemsPanelTemplate:
The ItemsPanelTemplate to use for arranging month items.
MonthItemTemplate
Gets or sets the DataTemplate to use for month items.
public DataTemplate MonthItemTemplate { get; set; }
Property Value
- DataTemplate:
The DataTemplate to use for month items.
NavigationButtonStyle
Gets or sets the Style to apply to the navigation buttons.
public Style NavigationButtonStyle { get; set; }
Property Value
SelectDateCommand
Gets the ICommand that is used to select a date.
public ICommand SelectDateCommand { get; }
Property Value
SelectDayOfWeekCommand
Gets the ICommand that is used to select an entire day of week.
public ICommand SelectDayOfWeekCommand { get; }
Property Value
SelectedDate
Gets or sets the selected date, if any, in the calendar.
public DateTime? SelectedDate { get; set; }
Property Value
SelectedDates
Gets the currently-selected dates in the calendar.
public DateRangeCollection SelectedDates { get; }
Property Value
- DateRangeCollection:
The currently-selected dates in the calendar.
SelectionMode
Gets or sets the selection mode of the calendar.
public MonthCalendarSelectionMode SelectionMode { get; set; }
Property Value
- MonthCalendarSelectionMode:
The selection mode of the calendar. The default value is
MonthCalendarSelectionMode.Single
.
SelectTodayCommand
Gets the ICommand that is used to select today's date.
public ICommand SelectTodayCommand { get; }
Property Value
Remarks
This command calls the SelectToday() method.
SelectWeekCommand
Gets the ICommand that is used to select an entire week.
public ICommand SelectWeekCommand { get; }
Property Value
Title
Gets the title that is displayed for the active view.
public string Title { get; }
Property Value
- String:
The title that is displayed for the active view.
TitleButtonStyle
Gets or sets the Style to apply to the title button.
public Style TitleButtonStyle { get; set; }
Property Value
TodayButtonStyle
Gets or sets the Style to apply to the Today button.
public Style TodayButtonStyle { get; set; }
Property Value
TodayButtonText
Gets the text to display in the Today button.
public string TodayButtonText { get; }
Property Value
- String:
The text to display in the Today button.
ViewResetMode
Gets or sets the view reset mode, which can be used to reset the view when the calendar loses focus.
public MonthCalendarViewResetMode ViewResetMode { get; set; }
Property Value
- MonthCalendarViewResetMode:
The view reset mode, which can be used to reset the view when the calendar loses focus. The default value is
MonthCalendarViewResetMode.None
.
WeekNumberItemContainerStyle
Gets or sets the Style to apply to week number items.
public Style WeekNumberItemContainerStyle { get; set; }
Property Value
WeekNumberItemsPanelTemplate
Gets or sets the ItemsPanelTemplate to use for arranging week number items.
public ItemsPanelTemplate WeekNumberItemsPanelTemplate { get; set; }
Property Value
- ItemsPanelTemplate:
The ItemsPanelTemplate to use for arranging week number items.
WeekNumberItemTemplate
Gets or sets the DataTemplate to use for week number items.
public DataTemplate WeekNumberItemTemplate { get; set; }
Property Value
- DataTemplate:
The DataTemplate to use for week number items.
YearItemsPanelTemplate
Gets or sets the ItemsPanelTemplate to use for arranging year items.
public ItemsPanelTemplate YearItemsPanelTemplate { get; set; }
Property Value
- ItemsPanelTemplate:
The ItemsPanelTemplate to use for arranging year items.
YearItemTemplate
Gets or sets the DataTemplate to use for year items.
public DataTemplate YearItemTemplate { get; set; }
Property Value
- DataTemplate:
The DataTemplate to use for year items.
ZoomInCommand
Gets the ICommand that is used to zoom in.
public ICommand ZoomInCommand { get; }
Property Value
ZoomOutCommand
Gets the ICommand that is used to zoom out.
public ICommand ZoomOutCommand { get; }
Property Value
Methods
OnApplyTemplate()
Invoked whenever application code or internal processes call ApplyTemplate
.
public override void OnApplyTemplate()
OnCreateAutomationPeer()
Returns an AutomationPeer object for this control instance.
protected override AutomationPeer OnCreateAutomationPeer()
Returns
- AutomationPeer:
An AutomationPeer instance.
OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs)
Occurs when the property value has changed.
protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | DependencyPropertyChangedEventArgs | The DependencyPropertyChangedEventArgs containing data related to this event. |
OnKeyDown(KeyEventArgs)
Occurs when a key is pressed.
protected override void OnKeyDown(KeyEventArgs e)
Parameter | Type | Description |
---|---|---|
e | KeyEventArgs | The KeyEventArgs that contains the event data. |
Refresh(Boolean)
Refreshes the control.
public void Refresh(bool requiresNewView)
Parameter | Type | Description |
---|---|---|
requiresNewView | Boolean | Whether a new view is required (if UI elements are changing instead of only simple data). |
SelectToday()
Selects today's date.
public void SelectToday()
UpdateDayItem(MonthCalendarItem, DateTime)
Updates a MonthCalendarItem for the specified day.
protected virtual void UpdateDayItem(MonthCalendarItem item, DateTime date)
Parameter | Type | Description |
---|---|---|
item | MonthCalendarItem | The MonthCalendarItem to update. |
date | DateTime | The date for which to update the model. |
UpdateDayNameItem(MonthCalendarItem, DayOfWeek)
Updates a MonthCalendarItem for the specified day of week.
protected virtual void UpdateDayNameItem(MonthCalendarItem item, DayOfWeek dayOfWeek)
Parameter | Type | Description |
---|---|---|
item | MonthCalendarItem | The MonthCalendarItem to update. |
dayOfWeek | DayOfWeek | The upated day of week. |
UpdateDecadeItem(MonthCalendarItem, DateTime)
Updates a MonthCalendarItem for the specified decade.
protected virtual void UpdateDecadeItem(MonthCalendarItem item, DateTime date)
Parameter | Type | Description |
---|---|---|
item | MonthCalendarItem | The MonthCalendarItem to update. |
date | DateTime | The date for which to update the model. |
UpdateMonthItem(MonthCalendarItem, DateTime)
Updates a MonthCalendarItem for the specified month.
protected virtual void UpdateMonthItem(MonthCalendarItem item, DateTime date)
Parameter | Type | Description |
---|---|---|
item | MonthCalendarItem | The MonthCalendarItem to update. |
date | DateTime | The date for which to update the model. |
UpdateWeekNumberItem(MonthCalendarItem, Int32)
Updates a MonthCalendarItem for the specified week number.
protected virtual void UpdateWeekNumberItem(MonthCalendarItem item, int weekNumber)
Parameter | Type | Description |
---|---|---|
item | MonthCalendarItem | The MonthCalendarItem to update. |
weekNumber | Int32 | The updated week number. |
UpdateYearItem(MonthCalendarItem, DateTime)
Updates a MonthCalendarItem for the specified year.
protected virtual void UpdateYearItem(MonthCalendarItem item, DateTime date)
Parameter | Type | Description |
---|---|---|
item | MonthCalendarItem | The MonthCalendarItem to update. |
date | DateTime | The date for which to update the model. |
Events
SelectionChanged
Occurs after the SelectedDate property value and/or SelectedDates collection changes.
SelectionCommitted
Occurs when the selection is committed, either by pressing Enter
or clicking on a date value in single selection mode.
Fields
ActiveDateProperty
Identifies the ActiveDate dependency property. This field is read-only.
public static readonly DependencyProperty ActiveDateProperty
ActiveViewModeProperty
Identifies the ActiveViewMode dependency property. This field is read-only.
public static readonly DependencyProperty ActiveViewModeProperty
CalendarWeekRuleProperty
Identifies the CalendarWeekRule dependency property. This field is read-only.
public static readonly DependencyProperty CalendarWeekRuleProperty
CanRetainTimeProperty
Identifies the CanRetainTime dependency property. This field is read-only.
public static readonly DependencyProperty CanRetainTimeProperty
ClearButtonStyleProperty
Identifies the ClearButtonStyle dependency property. This field is read-only.
public static readonly DependencyProperty ClearButtonStyleProperty
ClearButtonTextProperty
Identifies the ClearButtonText dependency property. This field is read-only.
public static readonly DependencyProperty ClearButtonTextProperty
DayItemsPanelTemplateProperty
Identifies the DayItemsPanelTemplate dependency property. This field is read-only.
public static readonly DependencyProperty DayItemsPanelTemplateProperty
DayItemTemplateProperty
Identifies the DayItemTemplate dependency property. This field is read-only.
public static readonly DependencyProperty DayItemTemplateProperty
DayItemTemplateSelectorProperty
Identifies the DayItemTemplateSelector dependency property. This field is read-only.
public static readonly DependencyProperty DayItemTemplateSelectorProperty
DayNameItemContainerStyleProperty
Identifies the DayNameItemContainerStyle dependency property. This field is read-only.
public static readonly DependencyProperty DayNameItemContainerStyleProperty
DayNameItemsPanelTemplateProperty
Identifies the DayNameItemsPanelTemplate dependency property. This field is read-only.
public static readonly DependencyProperty DayNameItemsPanelTemplateProperty
DayNameItemTemplateProperty
Identifies the DayNameItemTemplate dependency property. This field is read-only.
public static readonly DependencyProperty DayNameItemTemplateProperty
DayOfWeekFormatPatternProperty
Identifies the DayOfWeekFormatPattern dependency property. This field is read-only.
public static readonly DependencyProperty DayOfWeekFormatPatternProperty
DecadeItemsPanelTemplateProperty
Identifies the DecadeItemsPanelTemplate dependency property. This field is read-only.
public static readonly DependencyProperty DecadeItemsPanelTemplateProperty
DecadeItemTemplateProperty
Identifies the DecadeItemTemplate dependency property. This field is read-only.
public static readonly DependencyProperty DecadeItemTemplateProperty
DisabledDaysOfWeekProperty
Identifies the DisabledDaysOfWeek dependency property. This field is read-only.
public static readonly DependencyProperty DisabledDaysOfWeekProperty
FirstDayOfWeekProperty
Identifies the FirstDayOfWeek dependency property. This field is read-only.
public static readonly DependencyProperty FirstDayOfWeekProperty
IsClearButtonVisibleProperty
Identifies the IsClearButtonVisible dependency property. This field is read-only.
public static readonly DependencyProperty IsClearButtonVisibleProperty
IsDateDisabledFuncProperty
Identifies the IsDateDisabledFunc dependency property. This field is read-only.
public static readonly DependencyProperty IsDateDisabledFuncProperty
IsDayOfWeekSelectionEnabledProperty
Identifies the IsDayOfWeekSelectionEnabled dependency property. This field is read-only.
public static readonly DependencyProperty IsDayOfWeekSelectionEnabledProperty
IsTodayButtonVisibleProperty
Identifies the IsTodayButtonVisible dependency property. This field is read-only.
public static readonly DependencyProperty IsTodayButtonVisibleProperty
IsTodayHighlightedProperty
Identifies the IsTodayHighlighted dependency property. This field is read-only.
public static readonly DependencyProperty IsTodayHighlightedProperty
IsWeekNumberColumnVisibleProperty
Identifies the IsWeekNumberColumnVisible dependency property. This field is read-only.
public static readonly DependencyProperty IsWeekNumberColumnVisibleProperty
IsWeekNumberSelectionEnabledProperty
Identifies the IsWeekNumberSelectionEnabled dependency property. This field is read-only.
public static readonly DependencyProperty IsWeekNumberSelectionEnabledProperty
MaximumProperty
Identifies the Maximum dependency property. This field is read-only.
public static readonly DependencyProperty MaximumProperty
MaxSelectionCountProperty
Identifies the MaxSelectionCount dependency property. This field is read-only.
public static readonly DependencyProperty MaxSelectionCountProperty
MaxViewModeProperty
Identifies the MaxViewMode dependency property. This field is read-only.
public static readonly DependencyProperty MaxViewModeProperty
MinimumProperty
Identifies the Minimum dependency property. This field is read-only.
public static readonly DependencyProperty MinimumProperty
MonthItemsPanelTemplateProperty
Identifies the MonthItemsPanelTemplate dependency property. This field is read-only.
public static readonly DependencyProperty MonthItemsPanelTemplateProperty
MonthItemTemplateProperty
Identifies the MonthItemTemplate dependency property. This field is read-only.
public static readonly DependencyProperty MonthItemTemplateProperty
NavigationButtonStyleProperty
Identifies the NavigationButtonStyle dependency property. This field is read-only.
public static readonly DependencyProperty NavigationButtonStyleProperty
SelectedDateProperty
Identifies the SelectedDate dependency property. This field is read-only.
public static readonly DependencyProperty SelectedDateProperty
SelectionModeProperty
Identifies the SelectionMode dependency property. This field is read-only.
public static readonly DependencyProperty SelectionModeProperty
TitleButtonStyleProperty
Identifies the TitleButtonStyle dependency property. This field is read-only.
public static readonly DependencyProperty TitleButtonStyleProperty
TitleProperty
Identifies the Title dependency property. This field is read-only.
public static readonly DependencyProperty TitleProperty
TodayButtonStyleProperty
Identifies the TodayButtonStyle dependency property. This field is read-only.
public static readonly DependencyProperty TodayButtonStyleProperty
TodayButtonTextProperty
Identifies the TodayButtonText dependency property. This field is read-only.
public static readonly DependencyProperty TodayButtonTextProperty
ViewResetModeProperty
Identifies the ViewResetMode dependency property. This field is read-only.
public static readonly DependencyProperty ViewResetModeProperty
WeekNumberItemContainerStyleProperty
Identifies the WeekNumberItemContainerStyle dependency property. This field is read-only.
public static readonly DependencyProperty WeekNumberItemContainerStyleProperty
WeekNumberItemsPanelTemplateProperty
Identifies the WeekNumberItemsPanelTemplate dependency property. This field is read-only.
public static readonly DependencyProperty WeekNumberItemsPanelTemplateProperty
WeekNumberItemTemplateProperty
Identifies the WeekNumberItemTemplate dependency property. This field is read-only.
public static readonly DependencyProperty WeekNumberItemTemplateProperty
YearItemsPanelTemplateProperty
Identifies the YearItemsPanelTemplate dependency property. This field is read-only.
public static readonly DependencyProperty YearItemsPanelTemplateProperty
YearItemTemplateProperty
Identifies the YearItemTemplate dependency property. This field is read-only.
public static readonly DependencyProperty YearItemTemplateProperty
Inherited Members
- Object.ToString()
- Object.Equals(Object)
- Object.Equals(Object, Object)
- Object.ReferenceEquals(Object, Object)
- Object.GetHashCode()
- Object.GetType()
- Object.MemberwiseClone()