다음을 통해 공유


DatePicker.CalendarOpened Event

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Occurs when the drop-down Calendar is opened.

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

Syntax

'Declaration
Public Event CalendarOpened As RoutedEventHandler
public event RoutedEventHandler CalendarOpened
<sdk:DatePicker CalendarOpened="eventhandler"/>

Examples

The following code contains two event handlers, which update a TextBlock when the Calendar is opened or closed. This example is part of a larger example available in the DatePicker overview.

'Simple event handlers that updates a TextBlock when 
'the drop-down calendar is opened or closed. 
Private Sub dp1_CalendarOpened(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles dp1.CalendarOpened
    text1.Text = "DatePicker Calendar opened!"
End Sub

Private Sub dp1_CalendarClosed(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles dp1.CalendarClosed
    text1.Text = "DatePicker Calendar closed!"
End Sub
//Simple event handlers that updates a TextBlock when 
//the drop-down calendar is opened or closed.
void dp1_CalendarOpened(object sender, RoutedEventArgs e)
{
    text1.Text = "DatePicker Calendar opened!";
}
void dp1_CalendarClosed(object sender, RoutedEventArgs e)
{
    text1.Text = "DatePicker Calendar closed!";
}

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.