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.
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
Initializes a new instance of the RadDateTimePicker class with default settings. Sets up the control with AutoSize enabled and makes it selectable.
public RadDateTimePicker()
Properties
This property controls whether or not the next date part will be automatically selected when the user types.
public bool AutoSelectNextPart { get; set; }
Gets or sets whether the edit control is auto-sized
[Browsable(true)]
public override bool AutoSize { get; set; }
Overrides:
Gets or sets the location of the drop down showing the calendar
[Browsable(false)]
public Point CalendarLocation { get; set; }
Gets or sets the size of the calendar in the drop down
[Browsable(false)]
public Size CalendarSize { get; set; }
When ShowCheckBox is true, determines that the user has selected a value
public bool Checked { get; set; }
Gets or sets the culture supported by this calendar.
[TypeConverter(typeof(CultureInfoConverter))]
public CultureInfo Culture { get; set; }
Gets or sets the custom date/time format string.
public string CustomFormat { get; set; }
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.
[Browsable(false)]
public virtual RadDateTimePickerElement DateTimePickerElement { get; set; }
Gets the control's default size, which is 164 pixels wide by 20 pixels high.
protected override Size DefaultSize { get; }
Overrides:
Gets or sets the format of the date and time displayed in the control.
public virtual DateTimePickerFormat Format { get; set; }
Gets or sets the maximum date and time that can be selected in the control.
public DateTime MaxDate { get; set; }
Gets the maximum date value allowed for the DateTimePicker control.
[Browsable(false)]
public static DateTime MaximumDateTime { get; set; }
Gets or sets the minimum date and time that can be selected in the control.
public DateTime MinDate { get; set; }
Gets or sets the name of the control and synchronizes it with the internal TextBoxItem control.
public string Name { get; set; }
Gets or sets the date/time value assigned to the control.
[Bindable(true)]
[Browsable(false)]
public virtual DateTime? NullableValue { get; set; }
The DateTime value assigned to the date picker when the Value is null
[Bindable(false)]
public DateTime NullDate { get; set; }
Gets or sets the text that is displayed when the DateTimePicker contains a null reference.
public string NullText { get; set; }
Gets or sets a value indicating whether RadDateTimePicker is read-only.
public bool ReadOnly { get; set; }
true if the RadDateTimePicker is read-only; otherwise, false. The default is false.
Indicates whether a check box is displayed in the control. When the check box is unchecked no value is selected
public bool ShowCheckBox { get; set; }
Indicates whether a spin box rather than a drop down calendar is displayed for editing the control's value
public bool ShowUpDown { get; set; }
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.
[Browsable(true)]
[Bindable(true)]
[SettingsBindable(true)]
public override string Text { get; set; }
Overrides:
Methods
Checks whether the element's theme is defined by the control.
public override bool ControlDefinesThemeForElement(RadElement element)
The element to should be checked.
Returns:true if the control defines theme for this element, false otherwise.
Overrides:
If true is returned the ThemeResolutionService would not not set any theme to the element to avoid duplicating the style settings of the element.
Creates an accessible object for this control to support screen readers and other accessibility tools.
protected override AccessibleObject CreateAccessibilityInstance()
An instance of AccessibleObject appropriate for this control
Overrides:
Creates and initializes the RadDateTimePickerElement that provides the main functionality for this control. Sets up all necessary event handlers for the element.
protected override void CreateChildItems(RadElement parent)
The parent element that will contain the created child elements
Overrides:
Creates a new instance of the RadDateTimePickerElement for use in this control.
protected virtual RadDateTimePickerElement CreateElement()
A new instance of RadDateTimePickerElement
Releases the unmanaged resources used by the control and optionally releases the managed resources. Properly unregisters all event handlers to prevent memory leaks.
protected override void Dispose(bool disposing)
true to release both managed and unmanaged resources; false to release only unmanaged resources
Overrides:
Signals the object that initialization is complete and triggers the creation of the mask provider for the text box element.
public override void EndInit()
Overrides:
Raises the CheckedChanged event.
protected virtual void OnCheckedChanged(EventArgs e)
The arguments for the event.
Raises the Closed event.
protected virtual void OnClosed(RadPopupClosedEventArgs args)
The arguments for the event.
Raises the Closing event.
protected virtual void OnClosing(RadPopupClosingEventArgs args)
The arguments for the event which can be used to affect the closing behavior.
Handles the control's enter event by shifting focus to the contained text box element.
Raises the FormatChanged event
Handles the KeyDown event for the control.
public virtual void OnKeyDown(object sender, KeyEventArgs e)
The source of the event.
eKeyEventArgsA KeyEventArgs that contains the event data.
Handles the KeyPress event for the control.
public virtual void OnKeyPress(object sender, KeyPressEventArgs e)
The source of the event.
eKeyPressEventArgsA KeyPressEventArgs that contains the event data.
Handles the KeyUp event for the control.
public virtual void OnKeyUp(object sender, KeyEventArgs e)
The source of the event.
eKeyEventArgsA KeyEventArgs that contains the event data.
Handles the control's leave event by triggering the lost focus event.
Handles the control's lost focus event with protection against recursive focus loss handling.
Raises the ValueChanged event
Raises the Opening event.
protected virtual void OnOpening(CancelEventArgs args)
The arguments for the event which can be used to cancel the opening.
protected override void OnPreviewKeyDown(PreviewKeyDownEventArgs e)
Overrides:
Handles changes to the right-to-left layout property and propagates the setting to child elements.
protected override void OnRightToLeftChanged(EventArgs e)
The event data.
Overrides:
Handles theme changes to ensure all child elements properly reflect the current theme settings. Makes special adjustments for material themes.
protected override void OnThemeChanged()
Overrides:
Raises the ValueChanged event
Raises the ValueChanging event
protected virtual void OnValueChanging(ValueChangingEventArgs e)
protected override void ResetBackColorThemeOverrides()
Overrides:
Resets the Culture property to its default value ("en-US").
public void ResetCulture()
protected override void ResetForeColorThemeOverrides()
Overrides:
Resets the NullText property to its default value (empty string).
public void ResetNullText()
protected override void SetBackColorThemeOverrides()
Overrides:
protected override void SetForeColorThemeOverrides()
Overrides:
Sets the current value to behave as a null value. This clears the current date selection and displays the NullText if specified.
public void SetToNullValue()
Events
Occurs when the value of the checkbox in the editor is changed
public event EventHandler CheckedChanged
Occurs when the drop down is closed
public event RadPopupClosedEventHandler Closed
Occurs when the drop down is closing
public event RadPopupClosingEventHandler Closing
Occurs when the format of the control has changed
public event EventHandler FormatChanged
Occurs when the RadItem has focus and the user presses a key down
public event KeyEventHandler KeyDown
Occurs when the RadItem has focus and the user presses a key
public event KeyPressEventHandler KeyPress
Occurs when the RadItem has focus and the user releases the pressed key up
public event KeyEventHandler KeyUp
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.
public event EventHandler MaskProviderCreated
Occurs when the value of the control is changing
public event EventHandler NullableValueChanged
Occurs when the drop down is opened
public event EventHandler Opened
Occurs when the drop down is opening
public event CancelEventHandler Opening
Occurs when the CheckBox's state changes.
public event StateChangedEventHandler ToggleStateChanged
Occurs before the CheckBox's state changes.
public event StateChangingEventHandler ToggleStateChanging
Occurs when the value of the control has changed
public event EventHandler ValueChanged
Occurs when the value of the control is changing
public event ValueChangingEventHandler ValueChanging