DateTimeEditBox Class
Represents a date/time edit box.
public class DateTimeEditBox : PartEditBoxBase<DateTime?>
- Inheritance:
- object Visual UIElement FrameworkElement Control PartEditBoxBase<DateTime?> object
- Derived:
- DateEditBox TimeEditBox
Constructors
DateTimeEditBox()
Initializes an instance of the class.
public DateTimeEditBox()
Properties
Format
The date/time format string.
HasPopupButtonWhenReadOnly
Indicates whether the control should display the popup button when the control is read-only.
protected override bool HasPopupButtonWhenReadOnly { get; }
Property Value
- bool:
trueif the control should display the popup button when the control is read-only; otherwise,false.
Maximum
The highest possible value.
Minimum
The lowest possible value.
ParsingStyles
The styles to be used when parsing date/time values from a string.
public DateTimeStyles ParsingStyles { get; set; }
Property Value
- DateTimeStyles:
The default value is AllowWhiteSpaces.
Remarks
When updating the styles, it is recommended to OR the new value with the default value of AllowWhiteSpaces or else white space characters may not parse correctly.
ResolvedFormat
The resolved date/time format string.
SetValueToNowCommand
The ICommand that sets the value to the current date/time.
SetValueToTodayCommand
The ICommand that sets the value to the current date.
Methods
CoerceParsedValue(DateTime?)
Coerces the parsed value from text, only using components from the value for which parts are displayed in the edit box.
protected virtual DateTime? CoerceParsedValue(DateTime? value)
| Parameter | Type | Description |
|---|---|---|
| value | DateTime? | The value to coerce. |
Returns
- DateTime?:
The coerced value.
Remarks
The logic in this method ensures that time-only edit boxes retain their dates, month/day date-only edit boxes retain their years, etc.
CoerceValidValue(DateTime?)
Coerces the value to be within range.
protected override DateTime? CoerceValidValue(DateTime? value)
| Parameter | Type | Description |
|---|---|---|
| value | DateTime? | The value to coerce. |
Returns
- DateTime?:
The coerced value.
ConvertToString(DateTime?)
Converts the specified value to a string representation.
protected override string ConvertToString(DateTime? valueToConvert)
| Parameter | Type | Description |
|---|---|---|
| valueToConvert | DateTime? | The value. |
Returns
- string:
The string representation of the specified value.
CreateIncrementalChangeRequest(IncrementalChangeRequestKind)
Creates an incremental change (spin) request.
protected override IncrementalChangeRequest<DateTime?> CreateIncrementalChangeRequest(IncrementalChangeRequestKind kind)
| Parameter | Type | Description |
|---|---|---|
| kind | IncrementalChangeRequestKind | The kind of request. |
Returns
- IncrementalChangeRequest<DateTime?>:
The incremental change (spin) request that was created.
GenerateParts()
Generates the parts for the edit box.
protected override IList<IPart> GenerateParts()
Returns
IsTextInputAllowed(string)
Indicates whether the input text is allowed if text input filtering is enabled.
protected override bool IsTextInputAllowed(string text)
| Parameter | Type | Description |
|---|---|---|
| text | string | The text to examine. |
Returns
- bool:
trueif the text input is allowed; otherwise,false.
See Also
IsValidValue(DateTime?)
Tests whether the specified value is valid.
protected override bool IsValidValue(DateTime? value)
| Parameter | Type | Description |
|---|---|---|
| value | DateTime? | The value to examine. |
Returns
- bool:
trueif the value is valid; otherwise,false.
OnPopupOpened()
Occurs when the popup is opened.
protected override void OnPopupOpened()
Remarks
The default method implementation focuses the first popup descendant control with a tab stop.
ResetValue()
Resets the value to a default value.
protected override void ResetValue()
TryConvertFromString(string?, bool, out DateTime?)
Tries to convert the specified text to a value.
protected override bool TryConvertFromString(string? textToConvert, bool canCoerce, out DateTime? value)
| Parameter | Type | Description |
|---|---|---|
| textToConvert | string | The text. |
| canCoerce | bool | Whether the returned value should be coerced to fall within the allowed value range. |
| value | DateTime? | Returns the value for the specified text. |
Returns
- bool:
trueif the text was converted to a value successfully; otherwise,false.
Fields
FormatProperty
Defines the Format property.
public static readonly DependencyProperty FormatProperty
MaximumProperty
Defines the Maximum property.
public static readonly DependencyProperty MaximumProperty
MinimumProperty
Defines the Minimum property.
public static readonly DependencyProperty MinimumProperty
ParsingStylesProperty
Defines the ParsingStyles property.
public static readonly DependencyProperty ParsingStylesProperty
ResolvedFormatProperty
Defines the ResolvedFormat property.
public static readonly DependencyProperty ResolvedFormatProperty
Inherited Members
- PartEditBoxBase<DateTime?>.ActivePartIndexProperty
- PartEditBoxBase<DateTime?>.CommitTriggersProperty
- PartEditBoxBase<DateTime?>.HasPopupProperty
- PartEditBoxBase<DateTime?>.InlinesProperty
- PartEditBoxBase<DateTime?>.InputScopeNameValueProperty
- PartEditBoxBase<DateTime?>.IntermediateValueProperty
- PartEditBoxBase<DateTime?>.IsArrowKeyPartNavigationEnabledProperty
- PartEditBoxBase<DateTime?>.IsEditableProperty
- PartEditBoxBase<DateTime?>.IsInputFilteringEnabledProperty
- PartEditBoxBase<DateTime?>.IsNonDefaultUsageContextProperty
- PartEditBoxBase<DateTime?>.IsNullAllowedProperty
- PartEditBoxBase<DateTime?>.IsPopupButtonVisibleProperty
- PartEditBoxBase<DateTime?>.IsPopupOpenProperty
- PartEditBoxBase<DateTime?>.IsReadOnlyProperty
- PartEditBoxBase<DateTime?>.IsSpinnerVisibleProperty
- PartEditBoxBase<DateTime?>.IsUndoEnabledProperty
- PartEditBoxBase<DateTime?>.PlaceholderTextProperty
- PartEditBoxBase<DateTime?>.PopupBackgroundProperty
- PartEditBoxBase<DateTime?>.PopupBorderBrushProperty
- PartEditBoxBase<DateTime?>.PopupPickerStyleProperty
- PartEditBoxBase<DateTime?>.SpinnerVisibilityProperty
- PartEditBoxBase<DateTime?>.SpinWrappingProperty
- PartEditBoxBase<DateTime?>.TextAlignmentProperty
- PartEditBoxBase<DateTime?>.UsageContextProperty
- PartEditBoxBase<DateTime?>.ValueProperty
- PartEditBoxBase<DateTime?>.Commit()
- PartEditBoxBase<DateTime?>.Commit(bool)
- PartEditBoxBase<DateTime?>.InvalidateParts()
- PartEditBoxBase<DateTime?>.OnApplyTemplate()
- PartEditBoxBase<DateTime?>.OnCreateAutomationPeer()
- PartEditBoxBase<DateTime?>.OnGotFocus(RoutedEventArgs)
- PartEditBoxBase<DateTime?>.OnIntermediateValueChanged(DateTime?, DateTime?)
- PartEditBoxBase<DateTime?>.OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs)
- PartEditBoxBase<DateTime?>.OnIsNullAllowedChanged(bool, bool)
- PartEditBoxBase<DateTime?>.OnKeyDown(KeyEventArgs)
- PartEditBoxBase<DateTime?>.OnLostFocus(RoutedEventArgs)
- PartEditBoxBase<DateTime?>.OnLostMouseCapture(MouseEventArgs)
- PartEditBoxBase<DateTime?>.OnMouseLeftButtonDown(MouseButtonEventArgs)
- PartEditBoxBase<DateTime?>.OnPreviewMouseUp(MouseButtonEventArgs)
- PartEditBoxBase<DateTime?>.OnPreviewTextInput(TextCompositionEventArgs)
- PartEditBoxBase<DateTime?>.OnValueChanged(DateTime?, DateTime?)
- PartEditBoxBase<DateTime?>.ProcessTextInput(string)
- PartEditBoxBase<DateTime?>.SelectAll()
- PartEditBoxBase<DateTime?>.UpdateIntermediateValueAndTextFromValue()
- PartEditBoxBase<DateTime?>.ActivePartIndex
- PartEditBoxBase<DateTime?>.CommitTriggers
- PartEditBoxBase<DateTime?>.CurrentSelectionLength
- PartEditBoxBase<DateTime?>.CurrentSelectionStartOffset
- PartEditBoxBase<DateTime?>.CurrentText
- PartEditBoxBase<DateTime?>.HasPopup
- PartEditBoxBase<DateTime?>.Inlines
- PartEditBoxBase<DateTime?>.InputScopeNameValue
- PartEditBoxBase<DateTime?>.IntermediateValue
- PartEditBoxBase<DateTime?>.IsArrowKeyPartNavigationEnabled
- PartEditBoxBase<DateTime?>.IsEditable
- PartEditBoxBase<DateTime?>.IsInputFilteringEnabled
- PartEditBoxBase<DateTime?>.IsNonDefaultUsageContext
- PartEditBoxBase<DateTime?>.IsNullAllowed
- PartEditBoxBase<DateTime?>.IsPopupButtonVisible
- PartEditBoxBase<DateTime?>.IsPopupOpen
- PartEditBoxBase<DateTime?>.IsReadOnly
- PartEditBoxBase<DateTime?>.IsSpinnerVisible
- PartEditBoxBase<DateTime?>.IsUndoEnabled
- PartEditBoxBase<DateTime?>.Parts
- PartEditBoxBase<DateTime?>.PlaceholderText
- PartEditBoxBase<DateTime?>.PopupBackground
- PartEditBoxBase<DateTime?>.PopupBorderBrush
- PartEditBoxBase<DateTime?>.PopupPickerStyle
- PartEditBoxBase<DateTime?>.ResetValueCommand
- PartEditBoxBase<DateTime?>.SmallDecrementValueCommand
- PartEditBoxBase<DateTime?>.SmallIncrementValueCommand
- PartEditBoxBase<DateTime?>.SpinnerVisibility
- PartEditBoxBase<DateTime?>.SpinWrapping
- PartEditBoxBase<DateTime?>.TextAlignment
- PartEditBoxBase<DateTime?>.UsageContext
- PartEditBoxBase<DateTime?>.Value
- PartEditBoxBase<DateTime?>.ValueChanged