C# Class Microsoft.Samples.KMoore.WPFSamples.DateControls.DatePicker

Inheritance: System.Windows.Controls.Control
Show file Open project: daszat/zetbox

Public Properties

Property Type Description
CanEditProperty System.Windows.DependencyProperty
DateConverterProperty System.Windows.DependencyProperty
DropDownButtonStyleProperty System.Windows.DependencyProperty
DropDownClosedEvent System.Windows.RoutedEvent
DropDownOpenedEvent System.Windows.RoutedEvent
InvalidEntryEvent System.Windows.RoutedEvent
IsDropDownOpenProperty System.Windows.DependencyProperty
IsReadOnlyProperty System.Windows.DependencyProperty
IsValidProperty System.Windows.DependencyProperty
MaxDateProperty System.Windows.DependencyProperty
MinDateProperty System.Windows.DependencyProperty
MonthCalendarStyleProperty System.Windows.DependencyProperty
NullValueTextProperty System.Windows.DependencyProperty
TextProperty System.Windows.DependencyProperty
ValueChangedEvent System.Windows.RoutedEvent
ValueProperty System.Windows.DependencyProperty

Private Properties

Property Type Description
AttachToVisualTree void
CoerceIsDropDownOpen object
CoerceMaxDate object
CoerceValue object
DatePicker System
DetachFromVisualTree void
DoFormat string
DoFormat string
DoParse bool
GetFlag bool
IsFocusable bool
KeyDownHandler void
KeyDownHandler void
KeyboardToggleDropDown void
OnCanEditChanged void
OnContextMenuClose void
OnContextMenuOpen void
OnDateConverterChanged void
OnDateSelectionChanged void
OnDropDownButtonStyleChanged void
OnEditableTextBoxKeyDown void
OnEditableTextBoxLostFocus void
OnEditableTextBoxTextChanged void
OnIsDropDownOpenChanged void
OnMaxDateChanged void
OnMinDateChanged void
OnMonthCalendarCommandPreviewExecuted void
OnMonthCalendarVisibleMonthChanged void
OnMouseButtonDown void
OnNullValueTextChanged void
OnValueChanged void
OpenOnLoad void
RefreshDropDownButtonStyle void
SelectFocusableDate void
SetFlag void
UpdateEditableTextBox void

Public Methods

Method Description
OnApplyTemplate ( ) : void

Called when the Template's tree has been generated

ToString ( ) : string

Returns a string representation for this control. "...DatePicker, Value:06/02/2006"

Protected Methods

Method Description
OnDropDownClosed ( RoutedEventArgs e ) : void

Raise DropDownClosed event

OnDropDownOpened ( RoutedEventArgs e ) : void

Raise DropDownOpened event

OnGotKeyboardFocus ( System.Windows.Input.KeyboardFocusChangedEventArgs e ) : void

Called when this element gets focus.

OnInvalidEntry ( InvalidEntryEventArgs e ) : void

This event is invoked when datepicker can't parse the input string correctly

OnLostMouseCapture ( System.Windows.Input.MouseEventArgs e ) : void

Close the dropdown content if DatePicker lost the mouse capture

OnPreviewMouseLeftButtonDown ( System.Windows.Input.MouseButtonEventArgs e ) : void

When datepicker is editable, clicks the entry box should close the datepicker..

OnValueChanged ( RoutedPropertyChangedEventArgs e ) : void

This method is invoked when the Value property changes.

Private Methods

Method Description
AttachToVisualTree ( ) : void

Detaches the EditableTextBox, MonthCalendar from old child tree and attaches them to a new one

CoerceIsDropDownOpen ( DependencyObject d, object value ) : object

Coerce IsDropDownOpen with IsLoaded, so set IsDropDownOpen to true before UI ready can work

CoerceMaxDate ( DependencyObject d, object value ) : object
CoerceValue ( DependencyObject d, object value ) : object
DatePicker ( ) : System

Static Constructor

DetachFromVisualTree ( ) : void

Clear the event, and detach our current EditableTextBox from ComboBox

DoFormat ( ) : string

Format Value property to a formatted string

DoFormat ( System.DateTime date ) : string
DoParse ( string text ) : bool

Parse the input string, if the input string is a valid date, return the Date, else return null

If the input entry equals NullValueText, Value will be set to null If the input entry is a valid date, Value will be set to the input date If the input entry isn't a valid date, InvalidEntry event will be fired, Value will still keep the old value (don't set to null)

GetFlag ( Flags flag ) : bool
IsFocusable ( FrameworkElement fe ) : bool

True if the element can be focused

KeyDownHandler ( System.Windows.Input.KeyEventArgs e ) : void
KeyDownHandler ( object sender, System.Windows.Input.KeyEventArgs e ) : void

Called when a key event occurs.

KeyboardToggleDropDown ( bool openDropDown, bool commitSelection ) : void

Close the dropdown and commit the selection if requested. Make sure to set the selection after the dropdown has closed Don't trigger any unnecessary navigation as a result of changing the selection.

OnCanEditChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnContextMenuClose ( object sender, System.Windows.Controls.ContextMenuEventArgs e ) : void
OnContextMenuOpen ( object sender, System.Windows.Controls.ContextMenuEventArgs e ) : void
OnDateConverterChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnDateSelectionChanged ( object sender, DateSelectionChangedEventArgs e ) : void
OnDropDownButtonStyleChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnEditableTextBoxKeyDown ( object sender, System.Windows.Input.KeyEventArgs e ) : void

If Key.Enter is pressed, DatePicker will parse the Text no matter it changed or not

OnEditableTextBoxLostFocus ( object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e ) : void

If EditableTextBoxSite loses focus and Text has been changed, DatePicker will parse Text

OnEditableTextBoxTextChanged ( object sender, System.Windows.Controls.TextChangedEventArgs e ) : void

If Text has been changed, the flag Flags.IsTextChanged will be set to true, so DatePicker can decide to parse the Text or not

OnIsDropDownOpenChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnMaxDateChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnMinDateChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnMonthCalendarCommandPreviewExecuted ( object sender, System.Windows.Input.ExecutedRoutedEventArgs args ) : void
OnMonthCalendarVisibleMonthChanged ( object sender, RoutedPropertyChangedEventArgs e ) : void
OnMouseButtonDown ( object sender, System.Windows.Input.MouseButtonEventArgs e ) : void

If we (or one of our children) are clicked, claim the focus

OnNullValueTextChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnValueChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OpenOnLoad ( object sender, RoutedEventArgs e ) : void
RefreshDropDownButtonStyle ( ) : void
SelectFocusableDate ( ) : void

Select the focusable date

SetFlag ( Flags flag, bool set ) : void
UpdateEditableTextBox ( string text ) : void

Update the Text to the TextBox in editable mode

Method Details

OnApplyTemplate() public method

Called when the Template's tree has been generated
public OnApplyTemplate ( ) : void
return void

OnDropDownClosed() protected method

Raise DropDownClosed event
protected OnDropDownClosed ( RoutedEventArgs e ) : void
e System.Windows.RoutedEventArgs
return void

OnDropDownOpened() protected method

Raise DropDownOpened event
protected OnDropDownOpened ( RoutedEventArgs e ) : void
e System.Windows.RoutedEventArgs
return void

OnGotKeyboardFocus() protected method

Called when this element gets focus.
protected OnGotKeyboardFocus ( System.Windows.Input.KeyboardFocusChangedEventArgs e ) : void
e System.Windows.Input.KeyboardFocusChangedEventArgs
return void

OnInvalidEntry() protected method

This event is invoked when datepicker can't parse the input string correctly
protected OnInvalidEntry ( InvalidEntryEventArgs e ) : void
e InvalidEntryEventArgs
return void

OnLostMouseCapture() protected method

Close the dropdown content if DatePicker lost the mouse capture
protected OnLostMouseCapture ( System.Windows.Input.MouseEventArgs e ) : void
e System.Windows.Input.MouseEventArgs
return void

OnPreviewMouseLeftButtonDown() protected method

When datepicker is editable, clicks the entry box should close the datepicker..
protected OnPreviewMouseLeftButtonDown ( System.Windows.Input.MouseButtonEventArgs e ) : void
e System.Windows.Input.MouseButtonEventArgs
return void

OnValueChanged() protected method

This method is invoked when the Value property changes.
protected OnValueChanged ( RoutedPropertyChangedEventArgs e ) : void
e RoutedPropertyChangedEventArgs RoutedPropertyChangedEventArgs contains the old and new value.
return void

ToString() public method

Returns a string representation for this control. "...DatePicker, Value:06/02/2006"
public ToString ( ) : string
return string

Property Details

CanEditProperty public static property

The DependencyProperty for the CanEdit property
public static DependencyProperty,System.Windows CanEditProperty
return System.Windows.DependencyProperty

DateConverterProperty public static property

The DependencyProperty for the DateConverter Property
public static DependencyProperty,System.Windows DateConverterProperty
return System.Windows.DependencyProperty

DropDownButtonStyleProperty public static property

The DependencyProperty for the DropDownButtonStyle property. Flags: none Default Value: null
public static DependencyProperty,System.Windows DropDownButtonStyleProperty
return System.Windows.DependencyProperty

DropDownClosedEvent public static property

DropDownClosed event
public static RoutedEvent,System.Windows DropDownClosedEvent
return System.Windows.RoutedEvent

DropDownOpenedEvent public static property

DropDownOpened event
public static RoutedEvent,System.Windows DropDownOpenedEvent
return System.Windows.RoutedEvent

InvalidEntryEvent public static property

InvalidEntry event
public static RoutedEvent,System.Windows InvalidEntryEvent
return System.Windows.RoutedEvent

IsDropDownOpenProperty public static property

The DependencyProperty for the IsDropDownOpen property
public static DependencyProperty,System.Windows IsDropDownOpenProperty
return System.Windows.DependencyProperty

IsReadOnlyProperty public static property

The DependencyProperty for the IsReadOnly Property
public static DependencyProperty,System.Windows IsReadOnlyProperty
return System.Windows.DependencyProperty

IsValidProperty public static property

The DependencyProperty for the IsValid property.
public static DependencyProperty,System.Windows IsValidProperty
return System.Windows.DependencyProperty

MaxDateProperty public static property

The Property for the MaxDate property.
public static DependencyProperty,System.Windows MaxDateProperty
return System.Windows.DependencyProperty

MinDateProperty public static property

The Property for the MinDate property.
public static DependencyProperty,System.Windows MinDateProperty
return System.Windows.DependencyProperty

MonthCalendarStyleProperty public static property

The DependencyProperty for the MonthCalendarStyle Property
public static DependencyProperty,System.Windows MonthCalendarStyleProperty
return System.Windows.DependencyProperty

NullValueTextProperty public static property

The DependencyProperty for the NullValueText Property
public static DependencyProperty,System.Windows NullValueTextProperty
return System.Windows.DependencyProperty

TextProperty public static property

The DependencyProperty for the Text property.
public static DependencyProperty,System.Windows TextProperty
return System.Windows.DependencyProperty

ValueChangedEvent public static property

Event ID correspond to Value changed event
public static RoutedEvent,System.Windows ValueChangedEvent
return System.Windows.RoutedEvent

ValueProperty public static property

The DependencyProperty for the Value property
public static DependencyProperty,System.Windows ValueProperty
return System.Windows.DependencyProperty