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。 用户无法滚动到或选择此范围之外的日期。 If you set the SelectedDate property to a date that is after DisplayDateEnd, DisplayDateEnd is set to the same value as SelectedDate.

依赖项属性信息

标识符字段 DisplayDateEndProperty
元数据属性设置为 true BindsTwoWayByDefault

XAML 属性用法

<Calendar DisplayDateEnd="dateTimeString"/>  

XAML 值

dateTimeString
日期,采用 DateTime XAML 语法 主题中列出的格式之一。

适用于

另请参阅