Calendar.DisplayDateEnd Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets the last date in the date range that is available in the calendar.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

Public Property DisplayDateEnd As Nullable(Of Date)

Property Value

Type: System.Nullable(Of DateTime)

The last date that is available in the calendar.

You can restrict the range of a Calendar by setting the DisplayDateStart and DisplayDateEnd properties. A user cannot scroll to or select dates outside of this range. If you set the SelectedDate property to a date that is after DisplayDateEnd, DisplayDateEnd is set to the same value as SelectedDate.

<Calendar DisplayDateEnd="dateTimeString"/>


A date that is in one of the formats that are listed in the DateTime XAML Syntax topic.

The following code sets up a Calendar with a particular range of displayable dates, and sets the currently selected and displayed date.

' 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. 
<!-- Create a Calendar that displays 1/10/2009
           through 4/18/2009. -->
<Calendar Margin="20" 

.NET Framework
Available since 4.0
Available since 2.0
Return to top