Calendar.DisplayDateEnd 屬性

定義

取得或設定行事曆中可用日期範圍內的最後一個日期。

public:
 property Nullable<DateTime> DisplayDateEnd { Nullable<DateTime> get(); void set(Nullable<DateTime> value); };
public DateTime? DisplayDateEnd { get; set; }
member this.DisplayDateEnd : Nullable<DateTime> with get, set
Public Property DisplayDateEnd As Nullable(Of DateTime)

屬性值

Nullable<DateTime>

行事曆中可用的最後一個日期。

範例

下列程式碼會 Calendar 設定具有特定範圍的可顯示日期,並設定目前選取和顯示的日期。

// Create a Calendar that displays 1/10/2009
// through 4/18/2009.
Calendar basicCalendar = new Calendar();
basicCalendar.DisplayDateStart = new DateTime(2009, 1, 10);
basicCalendar.DisplayDateEnd = new DateTime(2009, 4, 18);
basicCalendar.DisplayDate = new DateTime(2009, 3, 15);
basicCalendar.SelectedDate = new DateTime(2009, 2, 15);

// root is a Panel that is defined elswhere.
root.Children.Add(basicCalendar);
' Create a Calendar that displays 1/10/2009 
' through 4/18/2009. 
Dim basicCalendar As New Calendar()
basicCalendar.DisplayDateStart = New DateTime(2009, 1, 10)
basicCalendar.DisplayDateEnd = New DateTime(2009, 4, 18)
basicCalendar.DisplayDate = New DateTime(2009, 3, 15)
basicCalendar.SelectedDate = New DateTime(2009, 2, 15)

' root is a Panel that is defined elswhere. 
root.Children.Add(basicCalendar)
<!-- Create a Calendar that displays 1/10/2009
           through 4/18/2009. -->
<Calendar Margin="20" 
          SelectedDate="2/15/2009"
          DisplayDate="3/15/2009"
          DisplayDateStart="1/10/2009"
          DisplayDateEnd="4/18/2009"/>

備註

您可以藉由設定 DisplayDateStartDisplayDateEnd 屬性來限制 的範圍 Calendar 。 使用者無法捲動至此範圍以外的日期或選取日期。 如果您將 SelectedDate 屬性設定為 之後 DisplayDateEnd 的日期, DisplayDateEnd 則會設定為與 SelectedDate 相同的值。

相依性屬性資訊

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

XAML Attribute Usage

<Calendar DisplayDateEnd="dateTimeString"/>  

XAML 值

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

適用於

另請參閱