Nerdynosaur
Nerdynosaur

Reputation: 1888

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

Upvotes: 2

Views: 5371

Answers (1)

Nerdynosaur
Nerdynosaur

Reputation: 1888

I found the answer, use the isDropDownOpen :

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

Upvotes: 5

Related Questions