ToolTipService.ToolTipOpeningEvent Feld

Definition

Bezeichnet das ToolTipOpening-Ereignis, das von Objekten verfügbar gemacht wird, die den ToolTipService-Dienst verwenden, um QuickInfos anzuzeigen.Identifies the ToolTipOpening event that is exposed by objects that use the ToolTipService service to display tooltips.

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

Feldwert

Beispiele

Im folgenden Beispiel wird gezeigt, wie ein Ereignishandler für das FrameworkElement.ToolTipOpening -Ereignis festgelegt wird.The following example shows how to set an event handler for the FrameworkElement.ToolTipOpening event. In diesem Fall ist der Ereignishandler tatsächlich für FrameworkElement.ToolTipOpening, da das Ellipse , an das der Handler angefügt ist, eine abgeleitete Klasse von FrameworkElementist.In this case, the event handler is actually for FrameworkElement.ToolTipOpening, 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

Hinweise

Das ToolTipOpening Ereignis tritt unmittelbar vor dem Öffnen einer QuickInfo auf.The ToolTipOpening event occurs immediately before a tooltip opens. Dieses Ereignis tritt nicht auf, wenn die QuickInfo nicht definiert ist oder wenn der QuickInfo-Inhalt auf NULL festgelegt ist.This event does not occur if the tooltip is not defined or if the tooltip content is set to null.

In diesem Feld wird das Verhalten des ToolTipOpening -Ereignisses für Klassen registriert, die diesen Dienst verwenden.This field registers the behavior of the ToolTipOpening event for classes that use this service. Die FrameworkElement Klassen FrameworkContentElement und implementieren den ToolTipService und machen dieses Ereignis über die Common Language Runtime (CLR)common language runtime (CLR) Accessoren FrameworkElement.ToolTipOpening und FrameworkContentElement.ToolTipOpeningverfügbar.The FrameworkElement and FrameworkContentElement classes both implement the ToolTipService and expose this event through the Common Language Runtime (CLR)common language runtime (CLR) accessors FrameworkElement.ToolTipOpening and FrameworkContentElement.ToolTipOpening.

Wenn Sie die QuickInfo als ToolTip -Objekt angeben, wird das Opened -Ereignis auch ausgelöst, wenn die QuickInfo geöffnet wird.If you specify the tooltip as a ToolTip object, the Opened event is also raised when the tooltip opens.

Gilt für:

Siehe auch