ToolTip.Closed 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在 ToolTip 关闭并不再可见时发生。
public:
event System::Windows::RoutedEventHandler ^ Closed;
public event System.Windows.RoutedEventHandler Closed;
member this.Closed : System.Windows.RoutedEventHandler
Public Custom Event Closed As RoutedEventHandler
事件类型
示例
以下示例演示如何为 Opened 和 Closed 事件设置事件处理程序。
tooltip.Opened +=
new RoutedEventHandler(whenToolTipOpens);
tooltip.Closed +=
new RoutedEventHandler(whenToolTipCloses);
AddHandler tooltip.Opened, AddressOf whenToolTipOpens
AddHandler tooltip.Closed, AddressOf whenToolTipCloses
void whenToolTipOpens(object sender, RoutedEventArgs e)
{
Ellipse ell = new Ellipse();
if (sender.GetType().FullName.Equals("System.Windows.Shapes.Ellipse"))
{
ell = (Ellipse)sender;
ell.Fill = Brushes.Blue;
}
else if (sender.GetType().FullName.Equals(
"System.Windows.Controls.ToolTip"))
{
ToolTip t = (ToolTip)sender;
Popup p = (Popup)t.Parent;
ell = (Ellipse)p.PlacementTarget;
ell.Fill = Brushes.Blue;
}
}
void whenToolTipCloses(object sender, RoutedEventArgs e)
{
Ellipse ell = new Ellipse();
if (sender.GetType().FullName.Equals(
"System.Windows.Shapes.Ellipse"))
{
ell = (Ellipse)sender;
ell.Fill = Brushes.Gray;
}
else if (sender.GetType().FullName.Equals(
"System.Windows.Controls.ToolTip"))
{
ToolTip t = (ToolTip)sender;
Popup p = (Popup)t.Parent;
ell = (Ellipse)p.PlacementTarget;
ell.Fill = Brushes.Gray;
}
}
Private Sub whenToolTipOpens(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim ell As New Ellipse()
If sender.GetType().FullName.Equals("System.Windows.Shapes.Ellipse") Then
ell = CType(sender, Ellipse)
ell.Fill = Brushes.Blue
ElseIf sender.GetType().FullName.Equals("System.Windows.Controls.ToolTip") Then
Dim t As ToolTip = CType(sender, ToolTip)
Dim p As Popup = CType(t.Parent, Popup)
ell = CType(p.PlacementTarget, Ellipse)
ell.Fill = Brushes.Blue
End If
End Sub
Private Sub whenToolTipCloses(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim ell As New Ellipse()
If sender.GetType().FullName.Equals("System.Windows.Shapes.Ellipse") Then
ell = CType(sender, Ellipse)
ell.Fill = Brushes.Gray
ElseIf sender.GetType().FullName.Equals("System.Windows.Controls.ToolTip") Then
Dim t As ToolTip = CType(sender, ToolTip)
Dim p As Popup = CType(t.Parent, Popup)
ell = CType(p.PlacementTarget, Ellipse)
ell.Fill = Brushes.Gray
End If
End Sub
注解
关闭 FrameworkElement.ToolTipClosing 控件时 ToolTip 也会引发 该事件。
路由事件信息
标识符字段 | ClosedEvent |
路由策略 | 鼓 泡 |
委托 | RoutedEventHandler |