共用方式為


DatePicker.CalendarOpened 事件

定義

在開啟下拉式 Calendar 時發生。

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

事件類型

範例

下列範例會建立 , DatePicker 並提供指示給使用者。 當使用者開啟或關閉 Calendar 時,會更新指示。

<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

備註

XAML Attribute Usage

<DatePicker CalendarOpened="eventhandler"/>  

適用於