Export (0) Print
Expand All

Calendar.DisplayDate Property

Gets or sets the date to display.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

Public Property DisplayDate As DateTime
<Calendar DisplayDate="dateTimeString"/>

XAML Values


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

Property Value

Type: System.DateTime
The date to display. The default is DateTime.Today.

Identifier field


Metadata properties set to true


The DisplayDate and DisplayMode properties specify what the calendar displays and what has focus within the calendar. The user can change the SelectedDate only when DisplayMode is set to Month, but the user might change the DisplayDate when the Calendar is in Year and Decade mode. The following table describes how the mode changes the DisplayDate.




DisplayDate changes when the user navigates to a different month.


The month of DisplayDate changes when the user clicks or navigates to a different month.


The year of DisplayDate changes when the user clicks or navigates to another year.

DisplayDate is ignored if its value is outside of the range of dates that is specified by DisplayDateStart and DisplayDateEnd properties.

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

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft