Class RadDateTimePicker
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.
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.UI.dll
Syntax
[TelerikToolboxCategory("Editors")]
public class RadDateTimePicker : RadEditorControl, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IPCHost, IAnalyticsProvider
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.
Declaration
public bool AutoSelectNextPart { get; set; }
Property Value
System.Boolean
|
AutoSize
Gets or sets whether the edit control is auto-sized
Declaration
public override bool AutoSize { get; set; }
Property Value
System.Boolean
|
Overrides
CalendarLocation
Gets or sets the location of the drop down showing the calendar
Declaration
public Point CalendarLocation { get; set; }
Property Value
System.Drawing.Point
|
CalendarSize
Gets or sets the size of the calendar in the drop down
Declaration
public Size CalendarSize { get; set; }
Property Value
System.Drawing.Size
|
Checked
When ShowCheckBox is true, determines that the user has selected a value
Declaration
public bool Checked { get; set; }
Property Value
System.Boolean
|
Culture
Gets or sets the culture supported by this calendar.
Declaration
public CultureInfo Culture { get; set; }
Property Value
System.Globalization.CultureInfo
|
CustomFormat
Gets or sets the custom date/time format string.
Declaration
public string CustomFormat { get; set; }
Property Value
System.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
public virtual RadDateTimePickerElement DateTimePickerElement { get; set; }
Property Value
RadDateTimePickerElement
|
DefaultSize
Gets the control's default size, which is 164 pixels wide by 20 pixels high.
Declaration
protected override Size DefaultSize { get; }
Property Value
System.Drawing.Size
|
Format
Gets or sets the format of the date and time displayed in the control.
Declaration
public virtual DateTimePickerFormat Format { get; set; }
Property Value
System.Windows.Forms.DateTimePickerFormat
|
MaxDate
Gets or sets the maximum date and time that can be selected in the control.
Declaration
public DateTime MaxDate { get; set; }
Property Value
System.DateTime
|
MaximumDateTime
Gets the maximum date value allowed for the DateTimePicker control.
Declaration
public static DateTime MaximumDateTime { get; set; }
Property Value
System.DateTime
|
MinDate
Gets or sets the minimum date and time that can be selected in the control.
Declaration
public DateTime MinDate { get; set; }
Property Value
System.DateTime
|
Name
Gets or sets the name of the control and synchronizes it with the internal TextBoxItem control.
Declaration
public string Name { get; set; }
Property Value
System.String
|
NullableValue
Gets or sets the date/time value assigned to the control.
Declaration
public virtual DateTime? NullableValue { get; set; }
Property Value
System.Nullable<System.DateTime>
|
NullDate
The DateTime value assigned to the date picker when the Value is null
Declaration
public DateTime NullDate { get; set; }
Property Value
System.DateTime
|
NullText
Gets or sets the text that is displayed when the DateTimePicker contains a null reference.
Declaration
public string NullText { get; set; }
Property Value
System.String
|
ReadOnly
Gets or sets a value indicating whether RadDateTimePicker is read-only.
Declaration
public bool ReadOnly { get; set; }
Property Value
System.Boolean
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
Declaration
public bool ShowCheckBox { get; set; }
Property Value
System.Boolean
|
ShowUpDown
Indicates whether a spin box rather than a drop down calendar is displayed for editing the control's value
Declaration
public bool ShowUpDown { get; set; }
Property Value
System.Boolean
|
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
public override string Text { get; set; }
Property Value
System.String
|
Overrides
Value
Gets or sets the date/time value assigned to the control.
Declaration
public virtual DateTime Value { get; set; }
Property Value
System.DateTime
|
Methods
ControlDefinesThemeForElement(RadElement)
Declaration
public override bool ControlDefinesThemeForElement(RadElement element)
Parameters
RadElement
element
|
Returns
System.Boolean
|
Overrides
CreateAccessibilityInstance()
Creates an accessible object for this control to support screen readers and other accessibility tools.
Declaration
protected override AccessibleObject CreateAccessibilityInstance()
Returns
System.Windows.Forms.AccessibleObject
An instance of System.Windows.Forms.AccessibleObject appropriate for this control |
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
RadElement
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
RadDateTimePickerElement
A new instance of RadDateTimePickerElement |
Dispose(Boolean)
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
System.Boolean
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
System.EventArgs
e
The arguments for the event. |
OnClosed(RadPopupClosedEventArgs)
Raises the Closed event.
Declaration
protected virtual void OnClosed(RadPopupClosedEventArgs args)
Parameters
RadPopupClosedEventArgs
args
The arguments for the event. |
OnClosing(RadPopupClosingEventArgs)
Raises the Closing event.
Declaration
protected virtual void OnClosing(RadPopupClosingEventArgs args)
Parameters
RadPopupClosingEventArgs
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
System.EventArgs
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
System.EventArgs
e
The event data. |
OnFormatChanged(EventArgs)
Raises the FormatChanged event
Declaration
protected virtual void OnFormatChanged(EventArgs e)
Parameters
System.EventArgs
e
|
OnKeyDown(Object, KeyEventArgs)
Handles the KeyDown event for the control.
Declaration
public virtual void OnKeyDown(object sender, KeyEventArgs e)
Parameters
System.Object
sender
The source of the event. |
System.Windows.Forms.KeyEventArgs
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
System.Object
sender
The source of the event. |
System.Windows.Forms.KeyPressEventArgs
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
System.Object
sender
The source of the event. |
System.Windows.Forms.KeyEventArgs
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
System.EventArgs
e
The event data. |
OnLostFocus(EventArgs)
Handles the control's lost focus event with protection against recursive focus loss handling.
Declaration
protected override void OnLostFocus(EventArgs e)
Parameters
System.EventArgs
e
The event data. |
Overrides
OnNullableValueChanged(EventArgs)
Raises the ValueChanged event
Declaration
protected virtual void OnNullableValueChanged(EventArgs e)
Parameters
System.EventArgs
e
|
OnOpened(EventArgs)
Raises the Opened event.
Declaration
protected virtual void OnOpened(EventArgs args)
Parameters
System.EventArgs
args
The arguments for the event. |
OnOpening(CancelEventArgs)
Raises the Opening event.
Declaration
protected virtual void OnOpening(CancelEventArgs args)
Parameters
System.ComponentModel.CancelEventArgs
args
The arguments for the event which can be used to cancel the opening. |
OnPreviewKeyDown(PreviewKeyDownEventArgs)
Declaration
protected override void OnPreviewKeyDown(PreviewKeyDownEventArgs e)
Parameters
System.Windows.Forms.PreviewKeyDownEventArgs
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
System.EventArgs
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
System.EventArgs
e
|
OnValueChanging(ValueChangingEventArgs)
Raises the ValueChanging event
Declaration
protected virtual void OnValueChanging(ValueChangingEventArgs e)
Parameters
ValueChangingEventArgs
e
|
ProcessAutoSizeChanged(Boolean)
Declaration
protected override void ProcessAutoSizeChanged(bool value)
Parameters
System.Boolean
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()
ShouldSerializeMaxDate()
This property/method is not relevant for this class
Declaration
public bool ShouldSerializeMaxDate()
Returns
System.Boolean
true if the MaxDate property should be serialized; otherwise, false. |
ShouldSerializeMinDate()
This property/method is not relevant for this class
Declaration
public bool ShouldSerializeMinDate()
Returns
System.Boolean
true if the MinDate property should be serialized; otherwise, false. |
WndProc(ref Message)
Declaration
protected override void WndProc(ref Message m)
Parameters
System.Windows.Forms.Message
m
|
Overrides
Events
CheckedChanged
Occurs when the value of the checkbox in the editor is changed
Declaration
public event EventHandler CheckedChanged
Event Type
System.EventHandler
|
Closed
Occurs when the drop down is closed
Declaration
public event RadPopupClosedEventHandler Closed
Event Type
RadPopupClosedEventHandler
|
Closing
Occurs when the drop down is closing
Declaration
public event RadPopupClosingEventHandler Closing
Event Type
RadPopupClosingEventHandler
|
FormatChanged
Occurs when the format of the control has changed
Declaration
public event EventHandler FormatChanged
Event Type
System.EventHandler
|
KeyDown
Occurs when the RadItem has focus and the user presses a key down
Declaration
public event KeyEventHandler KeyDown
Event Type
System.Windows.Forms.KeyEventHandler
|
KeyPress
Occurs when the RadItem has focus and the user presses a key
Declaration
public event KeyPressEventHandler KeyPress
Event Type
System.Windows.Forms.KeyPressEventHandler
|
KeyUp
Occurs when the RadItem has focus and the user releases the pressed key up
Declaration
public event KeyEventHandler KeyUp
Event Type
System.Windows.Forms.KeyEventHandler
|
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 Type
System.EventHandler
|
NullableValueChanged
Occurs when the value of the control is changing
Declaration
public event EventHandler NullableValueChanged
Event Type
System.EventHandler
|
Opened
Occurs when the drop down is opened
Declaration
public event EventHandler Opened
Event Type
System.EventHandler
|
Opening
Occurs when the drop down is opening
Declaration
public event CancelEventHandler Opening
Event Type
System.ComponentModel.CancelEventHandler
|
ToggleStateChanged
Occurs when the CheckBox's state changes.
Declaration
public event StateChangedEventHandler ToggleStateChanged
Event Type
StateChangedEventHandler
|
ToggleStateChanging
Occurs before the CheckBox's state changes.
Declaration
public event StateChangingEventHandler ToggleStateChanging
Event Type
StateChangingEventHandler
|
ValueChanged
Occurs when the value of the control has changed
Declaration
public event EventHandler ValueChanged
Event Type
System.EventHandler
|
ValueChanging
Occurs when the value of the control is changing
Declaration
public event ValueChangingEventHandler ValueChanging
Event Type
ValueChangingEventHandler
|