ToolTipService.ToolTipClosingEvent Campo

Definizione

Identifica l'evento ToolTipClosing esposto da oggetti che utilizzano il servizio ToolTipService per visualizzare le descrizioni comandi.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 

Valore del campo

Esempi

Nell'esempio seguente viene illustrato come impostare un gestore eventi per l' ToolTipClosing evento.The following example shows how to set an event handler for the ToolTipClosing event. In questo caso, il gestore eventi è effettivamente per FrameworkElement.ToolTipClosing, perché la Ellipse classe in cui è associato il gestore è una classe FrameworkElementderivata di.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

Commenti

L' ToolTipClosing evento si verifica immediatamente prima della chiusura di una descrizione comando.The ToolTipClosing event occurs immediately before a tooltip closes.

Questo campo registra il comportamento dell' ToolTipClosingEvent evento per le classi che usano questo servizio.This field registers the behavior of the ToolTipClosingEvent event for classes that use this service. FrameworkContentElement ToolTipService Common Language Runtime (CLR)common language runtime (CLR) EntrambeleFrameworkElement.ToolTipClosing classi FrameworkContentElement.ToolTipClosinge implementano ed espongono questo evento tramite le funzioni di accesso e. FrameworkElementThe FrameworkElement and FrameworkContentElement classes both implement the ToolTipService and expose this event through the Common Language Runtime (CLR)common language runtime (CLR) accessors FrameworkElement.ToolTipClosing and FrameworkContentElement.ToolTipClosing.

Se si specifica la descrizione comando come ToolTip oggetto, l' Closed evento viene generato anche quando la descrizione comando viene chiusa.If you specify the tooltip as a ToolTip object, the Closed event is also raised when the tooltip closes.

Si applica a

Vedi anche