DisplayDate Property

DatePicker.DisplayDate Property

.NET Framework (current version)
 

Gets or sets the date to display.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public DateTime DisplayDate { get; set; }

Property Value

Type: System.DateTime

The date to display. The default is DateTime.Today.

Exception Condition
ArgumentOutOfRangeException

The specified date is not in the range defined by DisplayDateStart. and DisplayDateEnd.

This property affects the Calendar of the DatePicker. For more information, see the Calendar.DisplayDate property.

Identifier field

DisplayDateProperty

Metadata properties set to true

BindsTwoWayByDefault

This property allows the developer to specify a date to display if SelectedDate is null.

<DatePicker DisplayDate="dateTimeString"/>

dateTimeString

A date that is in one of the formats that are listed in the DateTime XAML Syntax topic.

The following example creates a DatePicker that is initialized with its calendar open and displaying July 7, 2009.

<DatePicker IsDropDownOpen="True"
            IsTodayHighlighted="False" 
            DisplayDate="7/7/09"/>

.NET Framework
Available since 4.0
Silverlight
Available since 2.0
Return to top
Show:
© 2016 Microsoft