Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
This topic has not yet been rated - Rate this topic

ToolTipService.ToolTipOpeningEvent Field

Identifies the ToolTipOpeningEvent event that is exposed by objects that use the ToolTipService service to display tooltips.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)

public static readonly RoutedEvent ToolTipOpeningEvent
public static final RoutedEvent ToolTipOpeningEvent
public static final var ToolTipOpeningEvent : RoutedEvent
You cannot use fields in XAML.

Field Value

The identifier for the ToolTipOpeningEvent event.

The ToolTipOpeningEvent event occurs immediately before a tooltip opens. This event does not occur if the tooltip is not defined or if the tooltip content is set to null.

This field registers the behavior of the ToolTipOpeningEvent event for classes that use this service. The FrameworkElement and FrameworkContentElement classes both implement the ToolTipService and expose this event through the common language runtime (CLR) accessors FrameworkElement.ToolTipOpening and FrameworkContentElement.ToolTipOpening.

If you specify the tooltip as a ToolTip object, the Opened event is also raised when the tooltip opens.

The following example shows how to set an event handler for the FrameworkElement.ToolTipOpening event. For the complete sample, see ToolTipService Sample.

    <Ellipse Height="25" Width="50" 
         Fill="Gray" 
         HorizontalAlignment="Left"
         ToolTipService.InitialShowDelay="1000"
         ToolTipService.ShowDuration="7000"
         ToolTipService.BetweenShowDelay="2000"
         ToolTipService.Placement="Right" 
         ToolTipService.PlacementRectangle="50,0,0,0"
         ToolTipService.HorizontalOffset="10" 
         ToolTipService.VerticalOffset="20"
         ToolTipService.HasDropShadow="false"
         ToolTipService.ShowOnDisabled="true" 
         ToolTipService.IsEnabled="true"
         ToolTipOpening="whenToolTipOpens"
         ToolTipClosing="whenToolTipCloses"
         >
  <Ellipse.ToolTip>
    <BulletDecorator>
      <BulletDecorator.Bullet>
        <Ellipse Height="10" Width="20" Fill="Blue"/>
      </BulletDecorator.Bullet>
      <TextBlock>Uses the ToolTipService class</TextBlock>
    </BulletDecorator>
  </Ellipse.ToolTip>
</Ellipse>


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;
    }           
}

ellipse2.AddHandler(ToolTipService.ToolTipOpeningEvent,
    new RoutedEventHandler(whenToolTipOpens));
ellipse2.AddHandler(ToolTipService.ToolTipClosingEvent,
    new RoutedEventHandler(whenToolTipCloses));

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.