DatePicker.CalendarOpened 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
当打开下拉 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 属性用法
<DatePicker CalendarOpened="eventhandler"/>