Calendar.SelectedDate 속성

정의

현재 선택한 날짜를 가져오거나 설정합니다.

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

속성 값

현재 선택된 날짜입니다. 기본값은 null입니다.

예외

지정한 날짜가 지정 DisplayDateStart 한 범위를 벗어나는 경우 DisplayDateEnd

-또는-

지정된 날짜가 컬렉션에 있습니다 BlackoutDates .

로 설정된 경우 SelectionMode 이외의 null 다른 항목으로 None설정된 경우.

예제

다음 예제에서는 표시 가능한 날짜의 특정 범위를 사용하여 만들고 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"/>

설명

종속성 속성 정보

Item 가치
식별자 필드 SelectedDateProperty
메타데이터 속성이 다음으로 설정됩니다. true BindsTwoWayByDefault

로 설정된 SingleDate경우 SelectionMode 이 속성을 사용합니다. 다른 모드에서는 이 속성이 항상 첫 번째 날짜입니다 SelectedDates.

XAML 특성 사용

<Calendar SelectedDate="dateTimeString"/>

XAML 값

dateTimeStringDateTime XAML 구문 항목에 나열된 형식 중 하나에 있는 날짜입니다.

적용 대상