編輯

共用方式為


DatePicker.DisplayDate Property

Definition

Gets or sets the date to display.

public:
 property DateTime DisplayDate { DateTime get(); void set(DateTime value); };
public DateTime DisplayDate { get; set; }
member this.DisplayDate : DateTime with get, set
Public Property DisplayDate As DateTime

Property Value

The date to display. The default is Today.

Exceptions

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

Examples

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"/>

Remarks

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

Dependency Property Information

Identifier field DisplayDateProperty
Metadata properties set to true BindsTwoWayByDefault

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

XAML Attribute Usage

<DatePicker DisplayDate="dateTimeString"/>  

XAML Values

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

Applies to

See also