Calendar.DisplayDate Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the date to display.
public:
property DateTime DisplayDate { DateTime get(); void set(DateTime value); };
public DateTime DisplayDate { get; set; }
member this.DisplayDate : DateTime with get, set
Public Property DisplayDate As DateTime
Property Value
The date to display. The default is Today.
Examples
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.
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"/>
Remarks
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.
DisplayMode | Action |
---|---|
Month | DisplayDate changes when the user navigates to a different month. |
Year | The month of DisplayDate changes when the user clicks or navigates to a different month. |
Decade | 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.
Dependency Property Information
Identifier field | DisplayDateProperty |
Metadata properties set to true |
BindsTwoWayByDefault |
XAML Attribute Usage
<Calendar DisplayDate="dateTimeString"/>
XAML Values
dateTimeString
A date that is in one of the formats that are listed in the DateTime XAML Syntax topic.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기