Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

DatePicker.CalendarOpened Event

Occurs when the drop-down Calendar is opened.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

public event RoutedEventHandler CalendarOpened
<DatePicker CalendarOpened="eventhandler"/>

The following example creates a DatePicker and provides instructions to the user. When the user opens or closes the Calendar, the instructions are updated.

<StackPanel>
  <TextBlock Name="textBlock1" 
             Text="Enter a date or click the calendar."/>
  <DatePicker CalendarOpened="DatePicker_CalendarOpened"
              CalendarClosed="DatePicker_CalendarClosed"/>
</StackPanel>
private void DatePicker_CalendarOpened(object sender, RoutedEventArgs e)
{
    textBlock1.Text = "Select a date from the calendar";
}

private void DatePicker_CalendarClosed(object sender, RoutedEventArgs e)
{
    textBlock1.Text = "Enter a date or click the calendar";
}

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4
Show:
© 2015 Microsoft