简体   繁体   中英

How to open the calendar of the datepicker from code behind?

I'm using WPF and C# to develop my application. In my application, i have two datepicker. The first datepicker required user to choose the Depart date and the second calendar require user to choose the Return date. So what i want to do is, after user choose the depart date, the calendar from the second datepicker will open up. May i know what is the event to open up the calendar?

 <DatePicker Name="departDate" SelectedDateChanged="departDate_SelectedDateChanged">   
 <DatePicker Name="returnDate" >

C# code snippet

private void departDate_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
{
    //returnDate.calendarOpen??
}

I found the answer, use the isDropDownOpen :

private void departDate_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
{
   returnDate.isDropDownOpen = true;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM