DatePicker.SelectedDateFormat 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定用來顯示選定日期的格式。
public:
property System::Windows::Controls::DatePickerFormat SelectedDateFormat { System::Windows::Controls::DatePickerFormat get(); void set(System::Windows::Controls::DatePickerFormat value); };
public System.Windows.Controls.DatePickerFormat SelectedDateFormat { get; set; }
member this.SelectedDateFormat : System.Windows.Controls.DatePickerFormat with get, set
Public Property SelectedDateFormat As DatePickerFormat
屬性值
用來顯示選定日期的格式。 預設為 Long。
例外狀況
指定的格式無效。
範例
下列範例會建立 ,以 DatePicker 使用周和月份名稱的未細分天數來顯示日期。
DatePicker datePickerFor2009 = new DatePicker();
datePickerFor2009.SelectedDate = new DateTime(2009, 3, 23);
datePickerFor2009.DisplayDateStart = new DateTime(2009, 1, 1);
datePickerFor2009.DisplayDateEnd = new DateTime(2009, 12, 31);
datePickerFor2009.SelectedDateFormat = DatePickerFormat.Long;
datePickerFor2009.FirstDayOfWeek = DayOfWeek.Monday;
// root is a Panel that is defined elsewhere.
root.Children.Add(datePickerFor2009);
Dim datePickerFor2009 As New DatePicker()
datePickerFor2009.SelectedDate = New DateTime(2009, 3, 23)
datePickerFor2009.DisplayDateStart = New DateTime(2009, 1, 1)
datePickerFor2009.DisplayDateEnd = New DateTime(2009, 12, 31)
datePickerFor2009.SelectedDateFormat = DatePickerFormat.[Long]
datePickerFor2009.FirstDayOfWeek = DayOfWeek.Monday
' root is a Panel that is defined elsewhere.
root.Children.Add(datePickerFor2009)
<!-- A DatePicker that has March 23, 2009 selected and
displays the Long date format. -->
<DatePicker SelectedDateFormat="Long" SelectedDate="3/23/09"
DisplayDateStart="1/01/09" DisplayDateEnd="12/31/09"
FirstDayOfWeek="Monday"/>
備註
相依性屬性資訊
識別碼欄位 | SelectedDateFormatProperty |
設定為 的中繼資料屬性 true |
無 |
XAML Attribute Usage
<DatePicker SelectedDateFormat="DatePickerFormat「/>