DatePicker.DisplayDate 屬性

定義

取得或設定要顯示的日期。

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

屬性值

DateTime

要顯示的日期。 預設為 Today

例外狀況

指定的日期不在 DisplayDateStart 所定義的範圍內。 和 DisplayDateEnd

範例

下列範例會 DatePicker 建立 ,其行事曆已開啟並顯示 2009 年 7 月 7 日。

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

備註

這個屬性會影響 CalendarDatePicker 。 如需詳細資訊,請參閱 Calendar.DisplayDate 屬性 (Property)。

相依性屬性資訊

識別碼欄位 DisplayDateProperty
設定為 的中繼資料屬性 true BindsTwoWayByDefault

此屬性可讓開發人員指定日期,以在 為 nullSelectedDate 顯示。

XAML Attribute Usage

<DatePicker DisplayDate="dateTimeString"/>  

XAML 值

dateTimeString
日期,其格式為 DateTime XAML 語法 主題中列出的其中一種格式。

適用於

另請參閱