C# Класс Microsoft.Samples.KMoore.WPFSamples.DateControls.MonthCalendar

Наследование: System.Windows.Controls.Control, IWeakEventListener
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
DataSourceDatePathProperty System.Windows.DependencyProperty
DataSourceDateXPathProperty System.Windows.DependencyProperty
DataSourceProperty System.Windows.DependencyProperty
DateSelectionChangedEvent System.Windows.RoutedEvent
DayContainerStyleProperty System.Windows.DependencyProperty
DayContainerStyleSelectorProperty System.Windows.DependencyProperty
DayHeaderStyleProperty System.Windows.DependencyProperty
DayTemplateProperty System.Windows.DependencyProperty
DayTemplateSelectorProperty System.Windows.DependencyProperty
FirstDayOfWeekProperty System.Windows.DependencyProperty
MaxDateProperty System.Windows.DependencyProperty
MaxSelectionCountProperty System.Windows.DependencyProperty
MinDateProperty System.Windows.DependencyProperty
NextButtonStyleProperty System.Windows.DependencyProperty
PreviousButtonStyleProperty System.Windows.DependencyProperty
SelectedDateProperty System.Windows.DependencyProperty
ShowsDayHeadersProperty System.Windows.DependencyProperty
ShowsTitleProperty System.Windows.DependencyProperty
ShowsWeekNumbersProperty System.Windows.DependencyProperty
TitleStyleProperty System.Windows.DependencyProperty
VisibleMonthChangedEvent System.Windows.RoutedEvent
VisibleMonthProperty System.Windows.DependencyProperty
WeekNumberStyleProperty System.Windows.DependencyProperty

Private Properties

Свойство Тип Описание
AddToDictionary void
AttachToVisualTree void
CoerceMaxDate object
CoerceVisibleMonth object
CreateVisibleDaysCollection ObservableCollection
DetachFromVisualTree void
FindFocusableDate DateTime?
GetCalendarDateByDate CalendarDate
GetFlag bool
GetKeyFromDataSourceItem DateTime?
IWeakEventListener bool
InvalidateVisibleDays void
InvokeDateSelectedChangedEvent void
IsFocusable bool
IsLeadingTrailingDay bool
IsValidDate bool
IsValidFirstDayOfWeek bool
IsValidMaxSelectionCount bool
IsValidNullableDate bool
MonthCalendar System
OnContainerLayoutUpdated void
OnContainerSelectionChanged void
OnDataSourceChanged void
OnDataSourceCollectionChanged void
OnDataSourceDatePathChanged void
OnDayContainerStyleChanged void
OnDayTemplateChanged void
OnDayTemplateSelectorChanged void
OnExecuteGotoCommand void
OnExecuteNextCommand void
OnExecutePreviousCommand void
OnFirstDayOfWeekChanged void
OnMaxDateChanged void
OnMaxMinDateChanged void
OnMaxSelectionCountChanged void
OnMinDateChanged void
OnNextButtonStyleChanged void
OnPreviousButtonStyleChanged void
OnQueryGotoCommand void
OnQueryNextCommand void
OnQueryPreviousCommand void
OnSelectedDateChanged void
OnSelectedDatesCollectionChanged void
OnVisibleMonthChanged void
RefreshDayTemplate void
RefreshNextButtonStyle void
RefreshPreviousButtonStyle void
RemoveFromDictionary void
RestoreSelection void
ScrollVisibleMonth void
SetFlag void
SetSelectionByRange void
TrimSelectedDates void
UpdateDataSource void
UpdateDataSourceToCalendarDates void

Открытые методы

Метод Описание
GetContainerFromDate ( System.DateTime date ) : MonthCalendarItem

Return the UI element corresponding to the given date. Returns null if the date does not belong to the visible days or if no UI has been generated for it.

OnApplyTemplate ( ) : void

Called when the Template's tree has been generated

ToString ( ) : string

Returns a string representation for this control.

Защищенные методы

Метод Описание
OnDateSelectionChanged ( DateSelectionChangedEventArgs e ) : void

Raise DateSelectionChanged event.

OnPreviewKeyDown ( System.Windows.Input.KeyEventArgs e ) : void

This is the method that responds to the PreviewKeyDown event.

Override OnPreviewKeyDown isn't recommended for Control Author, it's reserved for customer Because MonthCalenarContainer already handles the PageUp/PageDown/Home/End, we have to use Preview here.

OnVisibleMonthChanged ( RoutedPropertyChangedEventArgs e ) : void

Raise VisibleMonthChanged event.

Приватные методы

Метод Описание
AddToDictionary ( object value ) : void

Add value to data source dictionary

AttachToVisualTree ( ) : void

Walk to visual tree to find the MonthCalendarContainer. Set the GroupFactory and GroupPanel. Register the selection change event if it is a Selector.

CoerceMaxDate ( DependencyObject d, object value ) : object
CoerceVisibleMonth ( DependencyObject d, object value ) : object
CreateVisibleDaysCollection ( System.DateTime firstDate, System.DateTime lastDate, DayOfWeek firstDayOfWeek ) : ObservableCollection

Generate the visible days collection based on the input firstdate, lastdate and firstdayofweek

DetachFromVisualTree ( ) : void

Clear our layout-specific data, and detach our current itemscontrol from monthcalendar

FindFocusableDate ( System.DateTime start, System.DateTime end, bool direction ) : DateTime?

GetCalendarDateByDate ( System.DateTime date ) : CalendarDate

Get the CalendarDate by date

GetFlag ( Flags flag ) : bool
GetKeyFromDataSourceItem ( object value ) : DateTime?

Get the DateTime value from the value with DataSourceDatePath/XPath the value works as a key for data source dictionary

IWeakEventListener ( Type managerType, object sender, EventArgs e ) : bool

Handle events from the centralized event table

InvalidateVisibleDays ( int scrollChange ) : void

Invalidate the visible days when switch month

InvokeDateSelectedChangedEvent ( List unselected, List selected ) : void

Raise the SelectionChanged event.

IsFocusable ( FrameworkElement fe ) : bool

True if the element can be focused

IsLeadingTrailingDay ( System.DateTime date ) : bool

True if the date is leading or traing day

IsValidDate ( object value ) : bool

Validate input value in MonthCalendar (MinDate, MaxDate, VisibleMonth)

IsValidFirstDayOfWeek ( object value ) : bool
IsValidMaxSelectionCount ( object o ) : bool
IsValidNullableDate ( object value ) : bool

Validate input value in MonthCalendar

MonthCalendar ( ) : System

Static Constructor

OnContainerLayoutUpdated ( object sender, EventArgs e ) : void

Update the SelectedDates to UI if those dates are added before UI ready

OnContainerSelectionChanged ( object sender, System.Windows.Controls.SelectionChangedEventArgs e ) : void

Update the selected dates status when user changes it by UI

OnDataSourceChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnDataSourceCollectionChanged ( object sender, NotifyCollectionChangedEventArgs e ) : void

Update the CalendarDate.Data property when DataSource collection is changed

OnDataSourceDatePathChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnDayContainerStyleChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void

Called when DayContainerStyleProperty is invalidated on "d."

OnDayTemplateChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void

Called when DayTemplateProperty is invalidated on "d."

OnDayTemplateSelectorChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void

Called when DayTemplateSelectorProperty is invalidated on "d."

OnExecuteGotoCommand ( object target, System.Windows.Input.ExecutedRoutedEventArgs args ) : void
OnExecuteNextCommand ( object target, System.Windows.Input.ExecutedRoutedEventArgs args ) : void
OnExecutePreviousCommand ( object target, System.Windows.Input.ExecutedRoutedEventArgs args ) : void
OnFirstDayOfWeekChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnMaxDateChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnMaxMinDateChanged ( System.DateTime minDate, System.DateTime maxDate ) : void

Update the IsSelectable property of visible days and selected dates when max/min date has been changed

OnMaxSelectionCountChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnMinDateChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnNextButtonStyleChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnPreviousButtonStyleChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnQueryGotoCommand ( object target, System.Windows.Input.CanExecuteRoutedEventArgs args ) : void
OnQueryNextCommand ( object target, System.Windows.Input.CanExecuteRoutedEventArgs args ) : void
OnQueryPreviousCommand ( object target, System.Windows.Input.CanExecuteRoutedEventArgs args ) : void
OnSelectedDateChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnSelectedDatesCollectionChanged ( object sender, NotifyCollectionChangedEventArgs e ) : void

Handle SelectedDates collection changed event

OnVisibleMonthChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
RefreshDayTemplate ( ) : void

Refresh the ItemTemplate/ItemTemplateSelector/ItemContainerStyle if DayTemplate/DayTemplateSelecotr/DayContainerStyle is set

RefreshNextButtonStyle ( ) : void
RefreshPreviousButtonStyle ( ) : void
RemoveFromDictionary ( object value ) : void

Remove value from data source dictionary

RestoreSelection ( int scrollChange ) : void

Restore the selection UI after switching month

ScrollVisibleMonth ( int direction, int delta ) : void

Scroll the current visible month of MothCalendar based on delta and direction

SetFlag ( Flags flag, bool set ) : void
SetSelectionByRange ( System.DateTime start, System.DateTime end ) : void

Select the dates between start and end. If one of them is null, only select the other one

TrimSelectedDates ( int limit ) : void

Delete redundant selected dates to fit the new MaxSelectionCount value

UpdateDataSource ( ) : void
UpdateDataSourceToCalendarDates ( ) : void

Update the data source data to the specific calendar dates

Описание методов

GetContainerFromDate() публичный Метод

Return the UI element corresponding to the given date. Returns null if the date does not belong to the visible days or if no UI has been generated for it.
public GetContainerFromDate ( System.DateTime date ) : MonthCalendarItem
date System.DateTime
Результат MonthCalendarItem

OnApplyTemplate() публичный Метод

Called when the Template's tree has been generated
public OnApplyTemplate ( ) : void
Результат void

OnDateSelectionChanged() защищенный Метод

Raise DateSelectionChanged event.
protected OnDateSelectionChanged ( DateSelectionChangedEventArgs e ) : void
e DateSelectionChangedEventArgs
Результат void

OnPreviewKeyDown() защищенный Метод

This is the method that responds to the PreviewKeyDown event.
Override OnPreviewKeyDown isn't recommended for Control Author, it's reserved for customer Because MonthCalenarContainer already handles the PageUp/PageDown/Home/End, we have to use Preview here.
protected OnPreviewKeyDown ( System.Windows.Input.KeyEventArgs e ) : void
e System.Windows.Input.KeyEventArgs Event Arguments
Результат void

OnVisibleMonthChanged() защищенный Метод

Raise VisibleMonthChanged event.
protected OnVisibleMonthChanged ( RoutedPropertyChangedEventArgs e ) : void
e RoutedPropertyChangedEventArgs RoutedPropertyChangedEventArgs contains the old and new value.
Результат void

ToString() публичный Метод

Returns a string representation for this control.
public ToString ( ) : string
Результат string

Описание свойств

DataSourceDatePathProperty публичное статическое свойство

The DependencyProperty for the DataSourceDatePath property. Flags: none Default Value: null
public static DependencyProperty,System.Windows DataSourceDatePathProperty
Результат System.Windows.DependencyProperty

DataSourceDateXPathProperty публичное статическое свойство

The DependencyProperty for the DataSourceDateXPath property. Flags: none Default Value: null
public static DependencyProperty,System.Windows DataSourceDateXPathProperty
Результат System.Windows.DependencyProperty

DataSourceProperty публичное статическое свойство

The DependencyProperty for DataSource property
public static DependencyProperty,System.Windows DataSourceProperty
Результат System.Windows.DependencyProperty

DateSelectionChangedEvent публичное статическое свойство

An event fired when the selection changes
public static RoutedEvent,System.Windows DateSelectionChangedEvent
Результат System.Windows.RoutedEvent

DayContainerStyleProperty публичное статическое свойство

The DependencyProperty for the DayContainerStyle property. Flags: none Default Value: null
public static DependencyProperty,System.Windows DayContainerStyleProperty
Результат System.Windows.DependencyProperty

DayContainerStyleSelectorProperty публичное статическое свойство

The DependencyProperty for the DayContainerStyleSelector property. Flags: none Default Value: null
public static DependencyProperty,System.Windows DayContainerStyleSelectorProperty
Результат System.Windows.DependencyProperty

DayHeaderStyleProperty публичное статическое свойство

The DependencyProperty for the DayHeaderStyle property. Flags: none Default Value: null
public static DependencyProperty,System.Windows DayHeaderStyleProperty
Результат System.Windows.DependencyProperty

DayTemplateProperty публичное статическое свойство

The DependencyProperty for the DayTemplate property. Flags: none Default Value: null
public static DependencyProperty,System.Windows DayTemplateProperty
Результат System.Windows.DependencyProperty

DayTemplateSelectorProperty публичное статическое свойство

The DependencyProperty for the DayTemplateSelector property. Flags: none Default Value: null
public static DependencyProperty,System.Windows DayTemplateSelectorProperty
Результат System.Windows.DependencyProperty

FirstDayOfWeekProperty публичное статическое свойство

The DependencyProperty for FirstDayOfWeek property
public static DependencyProperty,System.Windows FirstDayOfWeekProperty
Результат System.Windows.DependencyProperty

MaxDateProperty публичное статическое свойство

The Property for the MaxDate property.
public static DependencyProperty,System.Windows MaxDateProperty
Результат System.Windows.DependencyProperty

MaxSelectionCountProperty публичное статическое свойство

The DependencyProperty for MaxSelectionCount property
public static DependencyProperty,System.Windows MaxSelectionCountProperty
Результат System.Windows.DependencyProperty

MinDateProperty публичное статическое свойство

The Property for the MinDate property.
public static DependencyProperty,System.Windows MinDateProperty
Результат System.Windows.DependencyProperty

NextButtonStyleProperty публичное статическое свойство

The DependencyProperty for the NextButtonStyle property. Flags: none Default Value: null
public static DependencyProperty,System.Windows NextButtonStyleProperty
Результат System.Windows.DependencyProperty

PreviousButtonStyleProperty публичное статическое свойство

The DependencyProperty for the PreviousButtonStyle property. Flags: none Default Value: null
public static DependencyProperty,System.Windows PreviousButtonStyleProperty
Результат System.Windows.DependencyProperty

SelectedDateProperty публичное статическое свойство

The DependencyProperty for SelectedDate property
public static DependencyProperty,System.Windows SelectedDateProperty
Результат System.Windows.DependencyProperty

ShowsDayHeadersProperty публичное статическое свойство

The DependencyProperty for ShowsDayHeaders property
public static DependencyProperty,System.Windows ShowsDayHeadersProperty
Результат System.Windows.DependencyProperty

ShowsTitleProperty публичное статическое свойство

The DependencyProperty for ShowsTitle property
public static DependencyProperty,System.Windows ShowsTitleProperty
Результат System.Windows.DependencyProperty

ShowsWeekNumbersProperty публичное статическое свойство

The DependencyProperty for ShowsWeekNumbers property
public static DependencyProperty,System.Windows ShowsWeekNumbersProperty
Результат System.Windows.DependencyProperty

TitleStyleProperty публичное статическое свойство

The DependencyProperty for the TitleStyle property. Flags: none Default Value: null
public static DependencyProperty,System.Windows TitleStyleProperty
Результат System.Windows.DependencyProperty

VisibleMonthChangedEvent публичное статическое свойство

An event fired when the display month switches
public static RoutedEvent,System.Windows VisibleMonthChangedEvent
Результат System.Windows.RoutedEvent

VisibleMonthProperty публичное статическое свойство

The DependencyProperty for VisibleMonth property
public static DependencyProperty,System.Windows VisibleMonthProperty
Результат System.Windows.DependencyProperty

WeekNumberStyleProperty публичное статическое свойство

The DependencyProperty for the WeekNumberStyle property. Flags: none Default Value: null
public static DependencyProperty,System.Windows WeekNumberStyleProperty
Результат System.Windows.DependencyProperty