DatePicker.CalendarOpened Event

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Occurs when the drop-down Calendar is opened.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

Public Event CalendarOpened As RoutedEventHandler

<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 Sub DatePicker_CalendarOpened(
             ByVal sender As System.Object,
             ByVal e As System.Windows.RoutedEventArgs)
    textBlock1.Text = "Select a date from the calendar"
End Sub

Private Sub DatePicker_CalendarClosed(
             ByVal sender As System.Object,
             ByVal e As System.Windows.RoutedEventArgs)
    textBlock1.Text = "Enter a date or click the calendar"
End Sub

.NET Framework
Available since 4.0
Silverlight
Available since 2.0
Return to top
Show: