Tech Off Thread

5 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Keeping tooltip open WPF C#

Back to Forum: Tech Off
  • User profile image
    BrunoW

    Hello all,

    I want to create a tooltip like Word 2007 shows when you select text.
    http://img167.imageshack.us/img167/9809/floatiefq4.gif

    I have no problem with putting buttons etc in the tooltip but the tooltip closes when I navigate with my mouse to over the tooltip before I can click any buttons.
    How can I keep the tooltip open when I am hovering over it?

    Thanks in advance.

  • User profile image
    littleguru

    This is actually no tooltip. It is a toolbar that is shown when you hover over it. This is very different! The tooltip is designed not to stand in your way: means if you move your mouse over it it's gone because you probably want to click something behind it...

  • User profile image
    jgilkey

    Try using the popup control instead of the tooltip.  It'll let you control when the menu is displayed.  You could use an event trigger to open the popup, and have the popup close automatically when the user clicks outside of the popup.

  • User profile image
    footballism

    ToolTip is hosted inside a Popup which in turn is rendered in a separate HwndSource, you should be able to mimic the ToolTip behaviour using Poup, and set its StaysOpen property to true as the following XAML illustrates:

    <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <
    Button Width="120" Height="30" Name="btn">
    <
    Popup IsOpen="True" StaysOpen="True" PlacementTarget="{Binding ElementName=btn}" Placement="Bottom">
    <
    Button Width="120" Height="30" Content="Button In ToolTip"/>
    </
    Popup>
    </
    Button>
    </
    Page>

  • User profile image
    BrunoW

    Thanks! I got it to work with the Popup class.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.