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

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-05 07:01:25

问题


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??
}

回答1:


I found the answer, use the isDropDownOpen :

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


来源:https://stackoverflow.com/questions/13831963/how-to-open-the-calendar-of-the-datepicker-from-code-behind

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!