ToolTipService.ToolTipClosingEvent フィールド

定義

ToolTipClosing サービスを使用してツールヒントを表示するオブジェクトによって公開される ToolTipService イベントを識別します。Identifies the ToolTipClosing event that is exposed by objects that use the ToolTipService service to display tooltips.

public: static initonly System::Windows::RoutedEvent ^ ToolTipClosingEvent;
public static readonly System.Windows.RoutedEvent ToolTipClosingEvent;
 staticval mutable ToolTipClosingEvent : System.Windows.RoutedEvent
Public Shared ReadOnly ToolTipClosingEvent As RoutedEvent 

フィールド値

RoutedEvent

次の例は、イベントのイベントハンドラーを設定する方法を示して ToolTipClosing います。The following example shows how to set an event handler for the ToolTipClosing event. この場合、ハンドラーがアタッチされているは FrameworkElement.ToolTipClosing の派生クラスであるため、イベントハンドラーは実際にはになり Ellipse FrameworkElement ます。In this case, the event handler is actually for FrameworkElement.ToolTipClosing, because the Ellipse where the handler is attached is a derived class of FrameworkElement.

ellipse2.AddHandler(ToolTipService.ToolTipOpeningEvent,
    new RoutedEventHandler(whenToolTipOpens));
ellipse2.AddHandler(ToolTipService.ToolTipClosingEvent,
    new RoutedEventHandler(whenToolTipCloses));
ellipse2.AddHandler(ToolTipService.ToolTipOpeningEvent, New RoutedEventHandler(AddressOf whenToolTipOpens))
ellipse2.AddHandler(ToolTipService.ToolTipClosingEvent, New RoutedEventHandler(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

注釈

イベントは、 ToolTipClosing ツールヒントが閉じられる直前に発生します。The ToolTipClosing event occurs immediately before a tooltip closes.

このフィールドは、 ToolTipClosingEvent このサービスを使用するクラスのイベントの動作を登録します。This field registers the behavior of the ToolTipClosingEvent event for classes that use this service. FrameworkElementクラスと FrameworkContentElement クラスは、どちらもを実装 ToolTipService し、共通言語ランタイム (CLR) アクセサーおよびを通じてこのイベントを公開し FrameworkElement.ToolTipClosing FrameworkContentElement.ToolTipClosing ます。The FrameworkElement and FrameworkContentElement classes both implement the ToolTipService and expose this event through the common language runtime (CLR) accessors FrameworkElement.ToolTipClosing and FrameworkContentElement.ToolTipClosing.

ツールヒントをオブジェクトとして指定すると、 ToolTip Closed ツールヒントが閉じたときにもイベントが発生します。If you specify the tooltip as a ToolTip object, the Closed event is also raised when the tooltip closes.

適用対象

こちらもご覧ください