編輯

共用方式為


DatePicker.CalendarClosed Event

Definition

Occurs when the drop-down Calendar is closed.

public:
 event System::Windows::RoutedEventHandler ^ CalendarClosed;
public event System.Windows.RoutedEventHandler CalendarClosed;
member this.CalendarClosed : System.Windows.RoutedEventHandler 
Public Custom Event CalendarClosed As RoutedEventHandler 
Public Event CalendarClosed As RoutedEventHandler 

Event Type

Examples

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";
}
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

Remarks

XAML Attribute Usage

<DatePicker CalendarClosed="eventhandler"/>  

Applies to