共用方式為


Calendar.SelectedDate 屬性

定義

取得或設定目前選取的日期。 這個 API 已經過時。 如需如何開發 ASP.NET 行動應用程式的資訊,請參閱 mobile Apps & Sites with ASP.NET

public:
 property DateTime SelectedDate { DateTime get(); void set(DateTime value); };
[System.ComponentModel.Bindable(true)]
public DateTime SelectedDate { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.SelectedDate : DateTime with get, set
Public Property SelectedDate As DateTime

屬性值

目前選取的日期。 預設值為 DateTime.MinValue 的值。

屬性

範例

下列程式代碼範例示範如何使用 SelectedDate 屬性來參考選取的日期。 此範例是概觀較大程式碼範例的 Calendar 一部分。

TextView1.Text = "The date you selected is " +
   Calendar1.SelectedDate.ToShortDateString();
TextView1.Text = "The date you selected is " & _
   Calendar1.SelectedDate.ToShortDateString()

備註

一般而言,您會將這個屬性與 屬性搭配 SelectionMode 使用,以判斷控件的 Calendar 選取日期。 若要這樣做,請將 屬性設定 SelectionModeDay - 此設定只允許從 Calendar 控件選取單一日期。

流覽至下一個或上一個月將不會更新此屬性。

此屬性的功能與 ASP.NET Calendar.SelectedDate 屬性相同。

適用於

另請參閱