Skip to main content
Version: 4.1

DateTimePicker

Namespace: Wisej.Web

Assembly: Wisej.Framework (4.1.0.0)

Represents a control that allows the user to select or type a date and a time.

public class DateTimePicker : Control, INotifyPropertyChanged, IModified, ILabel, IReadOnly, IValidation

There are 4 tooltip labels that can be localized for this control. They are already localized in the default languages provided by Wisej. An application can localize the tooltip labels by adding the string resources to the localized Resources.resx or /Properties/Resources.resx.

  • $Next year The tooltip text displayed on the popup calendar for the next-year button.
  • $Last year The tooltip text displayed on the popup calendar for the last-year button.
  • $Next month The tooltip text displayed on the popup calendar for the next-month button.
  • $Last month The tooltip text displayed on the popup calendar for the last-month button.

Constructors​

Instance member DateTimePicker()​

Initializes a new instance of the DateTimePicker class.

Instance member DateTimePicker(onValueChanged)​

Initializes a new instance of the DateTimePicker class with specific initial settings.

NameTypeDescription
onValueChangedAction<Object, EventArgs>Handler for the ValueChanged event.

Instance member DateTimePicker(label, onValueChanged)​

Initializes a new instance of DateTimePicker class with specific initial settings.

NameTypeDescription
labelStringInitial LabelText value.
onValueChangedAction<Object, EventArgs>Handler for the ValueChanged event.

Instance member DateTimePicker(location, size, onValueChanged)​

Initializes a new instance of DateTimePicker class with specific initial settings.

NameTypeDescription
locationPointThe Point representing the upper-left corner of the control relative to the upper-left corner of its container.
sizeSizeThe Size representing the height and width of the control.
onValueChangedAction<Object, EventArgs>The delegate to invoke when the ValueChanged event is raised.

Instance member DateTimePicker(label, location, size, onValueChanged)​

Initializes a new instance of DateTimePicker class with specific initial settings.

NameTypeDescription
labelStringInitial LabelText value.
locationPointThe Point representing the upper-left corner of the control relative to the upper-left corner of its container.
sizeSizeThe Size representing the height and width of the control.
onValueChangedAction<Object, EventArgs>The delegate to invoke when the ValueChanged event is raised.

Properties​

Instance member AutoSize​

Boolean: Returns or sets whether the height of the control is set automatically. (Default: True)

Instance member BorderStyle​

BorderStyle: Returns or sets the type of border that is drawn around the DateTimePicker. (Default: Solid)

Instance member Checked​

Boolean: Returns or sets whether the checkbox in the DateTimePicker is checked and the user can change the control's value. Works in conjunction with the ShowCheckBox property. (Default: True)

Instance member CustomFormat​

String: Returns or sets the custom date/time format string. (Default: "")

See Custom Date and Time Format Strings for the supported format definitions.

Protected member DefaultSize​

Size: Returns the default size for a text box control.

Instance member Editable​

Boolean: Returns or sets whether the user can edit the text in the control. (Default: True)

Instance member EnableNativeContextMenu​

Boolean: Enables or disables the browser's context menu. (Default: True)

Instance member FirstDayOfWeek​

Day: Returns or sets the first day of the week as displayed in the month calendar. (Default: Default)

Instance member Format​

DateTimePickerFormat: Returns or sets the format of the date/time value displayed in the control. (Default: Long)

Instance member HidePromptOnLeave​

Boolean: Returns or sets whether the prompt characters in the input mask are hidden when the masked datetime picker loses focus. (Default: False)

Instance member Invalid​

Boolean: Returns or sets a value that indicates that the control is invalid. (Default: False)

Instance member InvalidMessage​

String: Returns or sets the invalid message that is shown in the invalid tooltip. (Default: "")

Instance member Label​

LabelWrapper: Provides a label related to the control.

Instance member LabelText​

String: Returns or sets the localizable label associated with this control. (Default: "")

Instance member Mask​

String: Returns or sets the input mask. (Default: "")

When setting an edit mask on the DateTimePicker control you must also select a Format that matches the mask. Otherwise the formatted date selected using the drop down calendar or by code will be formatted into a string that is not compatible with the edit mask. For example, if the mask is "##/##/####" the Format should be Short or CustomFormat should be "dd/MM/yyyy".

See also the TextMaskFormat property to determine how the mask is stripped when reading the Text property.

Instance member MaxDate​

DateTime: Returns or sets the maximum date and time that can be selected in the control.

Throws:

Instance member MinDate​

DateTime: Returns or sets the minimum date and time that can be selected in the control.

Throws:

Instance member Modified​

Boolean: Returns or sets a value that indicates that the date time picker control has been modified by the user since the control was created or its contents were last set. (Default: False)

Instance member NullableValue​

Nullable<DateTime>: Returns or sets the date/time Value assigned to the control with the difference that if the value is DateTime.MinValue it returns null.

This property should be used when the DateTimePicker may hold a null date and it's bound to a database nullable column. Throws:

Instance member PreserveTime​

Boolean: Returns or sets whether the time portion of the Value is preserved when the date is changed. Since 4.0.6 (Default: True)

Instance member PromptChar​

Char: Returns or sets the character used to represent the absence of user input in the DateTimePicker control. (Default: _)

Throws:

  • ArgumentException The character specified when setting this property is not a valid prompt character.

Instance member ReadOnly​

Boolean: Returns or sets whether the control is read-only. (Default: False)

Instance member SelectOnEnter​

Boolean: Selects the text when gaining the focus. (Default: False)

Instance member ShowCalendar​

Boolean: Returns or sets a value indicating if a calendar button (drop down control) is displayed and can be used to pick the date/time value. (Default: True)

Instance member ShowCheckBox​

Boolean: Returns or sets whether a check box is displayed to the left of the selected date. (Default: False)

Instance member ShowToday​

Boolean: Returns or sets whether the current date is displayed at the bottom of the control. (Default: False)

Instance member ShowToolTips​

Boolean: Returns or sets whether the popup calendar shows ToolTips. (Default: True)

Instance member ShowUpDown​

Boolean: Returns or sets a value indicating if the spin buttons (up and down controls) are displayed and can be used to adjust the date/time value. (Default: False)

Instance member ShowWeekNumbers​

Boolean: Returns or sets whether the calendar control displays week numbers (1-52) to the left of each row of days. (Default: True)

Instance member Text​

String: Returns or sets the text associated with this control. (Default: "")

The default value is DateTime.Today

Instance member TextMaskFormat​

MaskFormat: Since 3.2.8 Returns or sets a value that determines whether literals and prompt characters are included in the Text value when the DateTimePicker also specifies a Mask. (Default: IncludeLiterals)

This property lets you control the value returned by the Text property when there is an edit Mask. The default is to remove the prompt and keep the literal in order to return a text value that can be parsed to a valid date: i.e. "1_/10/__23" is retuned as "1/10/23".

Since 3.2.8 Note that when the value is null or empty, and regardless of the mask, the Text property returns an empty string.

Instance member TodayDate​

DateTime: Returns or sets the value that is used by DateTimePicker as today's date.

Throws:

  • ArgumentOutOfRangeException The value is less than the minimum allowable date; or the value is greater than the maximum allowable date.

Instance member TodayFormat​

String: Returns or sets the format string used to display today's date. (Default: "d")

See Custom Date and Time Format Strings for the supported format definitions.

Instance member Tools​

ComponentToolCollection: Returns the instance of ComponentToolCollection associated with this control.

Instance member Value​

DateTime: Returns or sets the DateTime value assigned to the control.

Throws:

Instance member Watermark​

String: Returns or sets the text to show when the field is empty. (Default: null)

Methods​

Protected member Dispose(disposing)​

Dispose the control.

ParameterTypeDescription
disposingBooleantrue when this method is called by the application rather than a finalizer.

Protected member GetDisplayText(value)​

Formats the date value using the format type specified in Format and CustomFormat .

ParameterTypeDescription
valueNullable<DateTime>

Returns: String. The formatted text to display in the control.

Protected member OnCheckedChanged(e)​

Fires the CheckedChanged event.

ParameterTypeDescription
eEventArgsA EventArgs that contains the event data.

Protected member OnCloseUp(e)​

Fires the CloseUp event.

ParameterTypeDescription
eEventArgsAn EventArgs that contains the event data.

Protected member OnDropDown(e)​

Fires the DropDown event.

ParameterTypeDescription
eEventArgsAn EventArgs that contains the event data.

Protected member OnEditableChanged(e)​

Fires the EditableChanged event.

ParameterTypeDescription
eEventArgsAn EventArgs that contains the event data.

Protected member OnFormatChanged(e)​

Fires the FormatChanged event.

ParameterTypeDescription
eEventArgsAn EventArgs that contains the event data.

Protected member OnMaskChanged(e)​

Fires the MaskChanged event.

ParameterTypeDescription
eEventArgsAn EventArgs that contains event data.

Protected member OnModifiedChanged(e)​

Fires the ModifiedChanged event.

ParameterTypeDescription
eEventArgsA EventArgs that contains the event data.

Protected member OnReadOnlyChanged(e)​

Fires the ReadOnlyChanged event.

ParameterTypeDescription
eEventArgsAn EventArgs that contains the event data.

Protected member OnTextChanged(e)​

Fires the TextChanged event.

ParameterTypeDescription
eEventArgsAn EventArgs that contains the event data.

Protected member OnToolClick(e)​

Fires the ToolClick event.

ParameterTypeDescription
eToolClickEventArgsA ToolClickEventArgs that contains the event data.

Protected member OnValidating(e)​

Fires the Validating event.

ParameterTypeDescription
eCancelEventArgsA EventArgs that contains the event data.

Protected member OnValueChanged(e)​

Fires the ValueChanged event.

ParameterTypeDescription
eEventArgsAn EventArgs that contains the event data.

Protected member OnWebEvent(e)​

Processes the event from the client.

ParameterTypeDescription
eWisejEventArgsEvent arguments.

Protected member OnWebRender(config)​

Renders the client component.

ParameterTypeDescription
configObjectDynamic configuration object.

Protected member OnWebUpdate(state)​

Updates the client component using the state information.

ParameterTypeDescription
stateObjectDynamic state object.

Protected member ParseEditText(text, value)​

Parses a string to a valid DateTime using a range of formats, including the custom format.

ParameterTypeDescription
textStringThe text to part.
value by referenceDateTimeParsed DateTime value to store in the control.

Returns: Boolean. True if the text is considered a valid date; otherwise false.

Protected member SetBoundsCore(x, y, width, height, specified)​

Sets the specified bounds of the ComboBox control.

ParameterTypeDescription
xInt32The new Left property value of the control.
yInt32The new Top property value of the control.
widthInt32The new Width property value of the control.
heightInt32Not used.
specifiedBoundsSpecifiedA combination of the BoundsSpecified values.

Protected member ValidateEditText()​

Validates and updates the text displayed in the date/time picker.

Returns: Boolean.

Events​

Instance member CheckedChanged​

EventHandler Fired when the value of the Checked property changes.

Instance member CloseUp​

EventHandler Fired when the drop-down calendar is dismissed and disappears.

EventHandler Fired when the drop-down calendar is shown.

Instance member EditableChanged​

EventHandler Fired when the value of the Editable property has changed.

Instance member FormatChanged​

EventHandler Fired when the Format property value has changed.

Instance member MaskChanged​

EventHandler Occurs after the input mask is changed.

Instance member ModifiedChanged​

EventHandler Fired when the value of the Modified property has changed.

Instance member ReadOnlyChanged​

EventHandler Fired when the value of the ReadOnly property has changed.

Instance member ToolClick​

ToolClickEventHandler Fired when a ComponentTool is clicked.

Instance member ValueChanged​

EventHandler Fired when the Value property changes.

Inherited By​

NameDescription
DataGridViewDateTimePickerEditingControlRepresents a DateTimePicker control that can be hosted in a DataGridViewDateTimePickerCell.

Implements​

NameDescription
IUserDataProvides access to the UserData and Tag properties associated to the component implementing this interface.
IBindableComponentBindable components implement this interface.
IDropTargetControls that support drag & drop operations implement this interface.
ILabelProvides access to the LabelWrapper associated with the controls that implement this interface.
IReadOnlyProvides access to the ReadOnly property for coontrols that support the read-only mode.
IModifiedProvides access to the Modified property and ModifiedChanged event for controls that implement this interface.
IValidationProvides access to the validation events and properties property for controls that support validation.
IWisejComponentAll wisej components implement this interface.
IWisejControlAll wisej controls derived from the Control class must implement this interface.
IWisejSerializableAllows an object to serialize itself.