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)

속성 값

Nullable<DateTime>

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

예외

지정된 날짜가 DisplayDateStartDisplayDateEnd에서 지정된 범위 밖에 있습니다.

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

SelectionModeNone으로 설정되어 있을 때 null 이외의 값으로 설정되어 있는 경우

예제

다음 예제에서는 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"/>

설명

종속성 속성 정보

식별자 필드 SelectedDateProperty
메타 데이터 속성 설정 true BindsTwoWayByDefault

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

XAML 특성 사용

<Calendar SelectedDate="dateTimeString"/>  

XAML 값

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

적용 대상