In This Article

DatePicker Class

Represents a date picker.

[TemplatePart(Name = "PART_MonthCalendar", Type = typeof(MonthCalendar))]
public class DatePicker : PickerBase
Inheritance:
object Visual UIElement FrameworkElement Control PickerBase object

Constructors

DatePicker()

Initializes an instance of the class.

public DatePicker()

Properties

CanRetainTime

Indicates whether the various DateTime values can retain the time-portion, or if it is reset to midnight.

public bool CanRetainTime { get; set; }

Property Value

bool:

true if the various DateTime values can retain the time-portion; otherwise, false. The default value is false.

IsNullAllowed

Indicates whether null values are allowed to be entered by the user.

public bool IsNullAllowed { get; set; }

Property Value

bool:

true if null values are allowed to be entered by the user; otherwise false. The default value is false.

Maximum

The highest possible value.

public DateTime Maximum { get; set; }

Property Value

DateTime

Minimum

The lowest possible value.

public DateTime Minimum { get; set; }

Property Value

DateTime

Value

The value of the control.

public DateTime? Value { get; set; }

Property Value

DateTime?

Methods

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().

public override void OnApplyTemplate()

Events

ValueChanged

Occurs after the Value property value changes.

public event EventHandler? ValueChanged

Event Type

EventHandler

ValueCommitted

Occurs after the Value is committed, either by pressing Enter or clicking on a date value.

public event EventHandler? ValueCommitted

Event Type

EventHandler

Fields

CanRetainTimeProperty

Defines the CanRetainTime property.

public static readonly DependencyProperty CanRetainTimeProperty

IsNullAllowedProperty

Defines the IsNullAllowed property.

public static readonly DependencyProperty IsNullAllowedProperty

MaximumProperty

Defines the Maximum property.

public static readonly DependencyProperty MaximumProperty

MinimumProperty

Defines the Minimum property.

public static readonly DependencyProperty MinimumProperty

ValueProperty

Defines the Value property.

public static readonly DependencyProperty ValueProperty

Inherited Members

Extension Methods