ClassRadDateTimePicker
Represents a control that allows users to select a date and time value, and display that value in a customizable format. The control supports date validation, formatting, and a dropdown calendar for visual date selection.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
[TelerikToolboxCategory("Editors")]
[DefaultBindingProperty("Value")]
public class RadDateTimePicker : RadEditorControl, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IAnalyticsProvider
Inheritance: objectMarshalByRefObjectComponentControlScrollableControlRadControlRadEditorControlRadDateTimePicker
Implements:
Inherited Members
Constructors
RadDateTimePicker()
Initializes a new instance of the RadDateTimePicker class with default settings. Sets up the control with AutoSize enabled and makes it selectable.
Declaration
public RadDateTimePicker()
Properties
AutoSelectNextPart
This property controls whether or not the next date part will be automatically selected when the user types.
AutoSize
Gets or sets whether the edit control is auto-sized
Declaration
[Browsable(true)]
public override bool AutoSize { get; set; }
Property Value
Overrides
CalendarLocation
Gets or sets the location of the drop down showing the calendar
Declaration
[Browsable(false)]
public Point CalendarLocation { get; set; }
Property Value
CalendarSize
Gets or sets the size of the calendar in the drop down
Declaration
[Browsable(false)]
public Size CalendarSize { get; set; }
Property Value
Checked
When ShowCheckBox is true, determines that the user has selected a value
Culture
Gets or sets the culture supported by this calendar.
Declaration
[TypeConverter(typeof(CultureInfoConverter))]
public CultureInfo Culture { get; set; }
Property Value
CustomFormat
Gets or sets the custom date/time format string.
DateTimePickerElement
Gets the instance of RadDateTimePickerElement wrapped by this control. RadDateTimePickerElement is the main element in the hierarchy tree and encapsulates the actual functionality of RadDateTimePicker.
Declaration
[Browsable(false)]
public virtual RadDateTimePickerElement DateTimePickerElement { get; set; }
Property Value
DefaultSize
Gets the control's default size, which is 164 pixels wide by 20 pixels high.
Declaration
protected override Size DefaultSize { get; }
Property Value
Overrides
Format
Gets or sets the format of the date and time displayed in the control.
Declaration
public virtual DateTimePickerFormat Format { get; set; }
Property Value
MaxDate
Gets or sets the maximum date and time that can be selected in the control.
MaximumDateTime
Gets the maximum date value allowed for the DateTimePicker control.
Declaration
[Browsable(false)]
public static DateTime MaximumDateTime { get; set; }
Property Value
MinDate
Gets or sets the minimum date and time that can be selected in the control.
Name
Gets or sets the name of the control and synchronizes it with the internal TextBoxItem control.
NullDate
The DateTime value assigned to the date picker when the Value is null
Declaration
[Bindable(false)]
public DateTime NullDate { get; set; }
Property Value
NullText
Gets or sets the text that is displayed when the DateTimePicker contains a null reference.
NullableValue
Gets or sets the date/time value assigned to the control.
Declaration
[Bindable(true)]
[Browsable(false)]
public virtual DateTime? NullableValue { get; set; }
Property Value
ReadOnly
Gets or sets a value indicating whether RadDateTimePicker is read-only.
Declaration
public bool ReadOnly { get; set; }
Property Value
true if the RadDateTimePicker is read-only; otherwise, false. The default is false.
ShowCheckBox
Indicates whether a check box is displayed in the control. When the check box is unchecked no value is selected
ShowUpDown
Indicates whether a spin box rather than a drop down calendar is displayed for editing the control's value
Text
Gets or sets the text associated with this control. This is the displayed representation of the date/time value based on the current format settings.
Declaration
[Browsable(true)]
[Bindable(true)]
[SettingsBindable(true)]
public override string Text { get; set; }
Property Value
Overrides
Methods
ControlDefinesThemeForElement(RadElement)
Checks whether the element's theme is defined by the control.
Declaration
public override bool ControlDefinesThemeForElement(RadElement element)
Parameters
element
The element to should be checked.
Returns
true if the control defines theme for this element, false otherwise.
Overrides
Remarks
If true is returned the ThemeResolutionService would not not set any theme to the element to avoid duplicating the style settings of the element.
CreateAccessibilityInstance()
Creates an accessible object for this control to support screen readers and other accessibility tools.
Declaration
protected override AccessibleObject CreateAccessibilityInstance()
Returns
An instance of AccessibleObject appropriate for this control
Overrides
CreateChildItems(RadElement)
Creates and initializes the RadDateTimePickerElement that provides the main functionality for this control. Sets up all necessary event handlers for the element.
Declaration
protected override void CreateChildItems(RadElement parent)
Parameters
parent
The parent element that will contain the created child elements
Overrides
CreateElement()
Creates a new instance of the RadDateTimePickerElement for use in this control.
Declaration
protected virtual RadDateTimePickerElement CreateElement()
Returns
A new instance of RadDateTimePickerElement
Dispose(bool)
Releases the unmanaged resources used by the control and optionally releases the managed resources. Properly unregisters all event handlers to prevent memory leaks.
Declaration
protected override void Dispose(bool disposing)
Parameters
disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources
Overrides
EndInit()
Signals the object that initialization is complete and triggers the creation of the mask provider for the text box element.
Declaration
public override void EndInit()
Overrides
OnCheckedChanged(EventArgs)
Raises the CheckedChanged event.
Declaration
protected virtual void OnCheckedChanged(EventArgs e)
Parameters
e
The arguments for the event.
OnClosed(RadPopupClosedEventArgs)
Raises the Closed event.
Declaration
protected virtual void OnClosed(RadPopupClosedEventArgs args)
Parameters
args
The arguments for the event.
OnClosing(RadPopupClosingEventArgs)
Raises the Closing event.
Declaration
protected virtual void OnClosing(RadPopupClosingEventArgs args)
Parameters
args
The arguments for the event which can be used to affect the closing behavior.
OnEnabledChanged(EventArgs)
Declaration
protected override void OnEnabledChanged(EventArgs e)
Parameters
e
Overrides
OnEnter(EventArgs)
Handles the control's enter event by shifting focus to the contained text box element.
Declaration
protected override void OnEnter(EventArgs e)
Parameters
e
The event data.
Overrides
OnFormatChanged(EventArgs)
Raises the FormatChanged event
Declaration
protected virtual void OnFormatChanged(EventArgs e)
Parameters
e
OnKeyDown(object, KeyEventArgs)
Handles the KeyDown event for the control.
Declaration
public virtual void OnKeyDown(object sender, KeyEventArgs e)
Parameters
sender
The source of the event.
e
A KeyEventArgs that contains the event data.
OnKeyPress(object, KeyPressEventArgs)
Handles the KeyPress event for the control.
Declaration
public virtual void OnKeyPress(object sender, KeyPressEventArgs e)
Parameters
sender
The source of the event.
e
A KeyPressEventArgs that contains the event data.
OnKeyUp(object, KeyEventArgs)
Handles the KeyUp event for the control.
Declaration
public virtual void OnKeyUp(object sender, KeyEventArgs e)
Parameters
sender
The source of the event.
e
A KeyEventArgs that contains the event data.
OnLeave(EventArgs)
Handles the control's leave event by triggering the lost focus event.
Declaration
protected override void OnLeave(EventArgs e)
Parameters
e
The event data.
Overrides
OnLostFocus(EventArgs)
Handles the control's lost focus event with protection against recursive focus loss handling.
Declaration
protected override void OnLostFocus(EventArgs e)
Parameters
e
The event data.
Overrides
OnNullableValueChanged(EventArgs)
Raises the ValueChanged event
Declaration
protected virtual void OnNullableValueChanged(EventArgs e)
Parameters
e
OnOpened(EventArgs)
Raises the Opened event.
Declaration
protected virtual void OnOpened(EventArgs args)
Parameters
args
The arguments for the event.
OnOpening(CancelEventArgs)
Raises the Opening event.
Declaration
protected virtual void OnOpening(CancelEventArgs args)
Parameters
args
The arguments for the event which can be used to cancel the opening.
OnPreviewKeyDown(PreviewKeyDownEventArgs)
Declaration
protected override void OnPreviewKeyDown(PreviewKeyDownEventArgs e)
Parameters
e
Overrides
OnRightToLeftChanged(EventArgs)
Handles changes to the right-to-left layout property and propagates the setting to child elements.
Declaration
protected override void OnRightToLeftChanged(EventArgs e)
Parameters
e
The event data.
Overrides
OnThemeChanged()
Handles theme changes to ensure all child elements properly reflect the current theme settings. Makes special adjustments for material themes.
Declaration
protected override void OnThemeChanged()
Overrides
OnValueChanged(EventArgs)
Raises the ValueChanged event
Declaration
protected virtual void OnValueChanged(EventArgs e)
Parameters
e
OnValueChanging(ValueChangingEventArgs)
Raises the ValueChanging event
Declaration
protected virtual void OnValueChanging(ValueChangingEventArgs e)
Parameters
e
ProcessAutoSizeChanged(bool)
Declaration
protected override void ProcessAutoSizeChanged(bool value)
Parameters
value
Overrides
ResetBackColorThemeOverrides()
Declaration
protected override void ResetBackColorThemeOverrides()
Overrides
ResetCulture()
Resets the Culture property to its default value ("en-US").
Declaration
public void ResetCulture()
ResetForeColorThemeOverrides()
Declaration
protected override void ResetForeColorThemeOverrides()
Overrides
ResetNullText()
Resets the NullText property to its default value (empty string).
Declaration
public void ResetNullText()
SetBackColorThemeOverrides()
Declaration
protected override void SetBackColorThemeOverrides()
Overrides
SetForeColorThemeOverrides()
Declaration
protected override void SetForeColorThemeOverrides()
Overrides
SetToNullValue()
Sets the current value to behave as a null value. This clears the current date selection and displays the NullText if specified.
Declaration
public void SetToNullValue()
WndProc(ref Message)
Declaration
protected override void WndProc(ref Message m)
Parameters
m
Overrides
Events
CheckedChanged
Occurs when the value of the checkbox in the editor is changed
Closed
Occurs when the drop down is closed
Declaration
public event RadPopupClosedEventHandler Closed
Event Value
Closing
Occurs when the drop down is closing
Declaration
public event RadPopupClosingEventHandler Closing
Event Value
FormatChanged
Occurs when the format of the control has changed
KeyDown
Occurs when the RadItem has focus and the user presses a key down
KeyPress
Occurs when the RadItem has focus and the user presses a key
Declaration
public event KeyPressEventHandler KeyPress
Event Value
KeyUp
Occurs when the RadItem has focus and the user releases the pressed key up
MaskProviderCreated
Occurs when MaskProvider has been created This event will be fired multiple times because the provider is created when some properties changed Properties are: Mask, Culture, MaskType and more.
Declaration
public event EventHandler MaskProviderCreated
Event Value
NullableValueChanged
Occurs when the value of the control is changing
Declaration
public event EventHandler NullableValueChanged
Event Value
Opened
Occurs when the drop down is opened
Opening
Occurs when the drop down is opening
Declaration
public event CancelEventHandler Opening
Event Value
ToggleStateChanged
Occurs when the CheckBox's state changes.
Declaration
public event StateChangedEventHandler ToggleStateChanged
Event Value
ToggleStateChanging
Occurs before the CheckBox's state changes.
Declaration
public event StateChangingEventHandler ToggleStateChanging
Event Value
ValueChanged
Occurs when the value of the control has changed
ValueChanging
Occurs when the value of the control is changing
Declaration
public event ValueChangingEventHandler ValueChanging
Event Value