Only Bolivian Here
Only Bolivian Here

Reputation: 36773

How can I create a complex tooltip in WPF?

I have an Image control on my WPF Window and I'd like to display a complex tooltip when the mouse is hovering over this Image.

Imagine like a spell icon in World of Warcraft, you mouse over and the spells tooltip is shown.

How can I do this in XAML?

Upvotes: 0

Views: 1351

Answers (3)

Xcalibur37
Xcalibur37

Reputation: 2323

I recommend doing the following to what x0r stated:

<Image ToolTipService.ShowDuration="1440000">
    <Image.ToolTip>
        <ToolTip.Content>
            <!--...content goes here. -->
        </ToolTip.Content>
    </Image.ToolTip>
</Image>

This leaves the tooltip open for 24 hours (yes, it's a long time). This is just a way to override that annoying 5-second rule.

Upvotes: 1

thumbmunkeys
thumbmunkeys

Reputation: 20764

You can achieve it like this:

<Image>
    <Image.ToolTip>
        <ToolTip.Content>
            <!--...content goes here. -->
        </ToolTip.Content>
    </Image.ToolTip>
</Image>

Upvotes: 3

brunnerh
brunnerh

Reputation: 185553

You just put whatever you want into the ToolTip property in XML element syntax.

Upvotes: 1

Related Questions