Using images in tooltips

The tooltip came from an idea regarding how to show contextual help in the user interface and is now considered an essential part of a UX designer's tool bag.

A few decades ago, a UI designer came up with a clever idea regarding how to show contextual help in the user interface. That idea, the tooltip, is now considered an essential part of a UX designer's tool bag. You see them in any modern interface; here is an example from Visual Studio 2010.

When I hover the mouse over the toolbar button a little floating window pops up with explanatory text to clarify the purpose of the button. That's a tool tip, though I suspect you already knew that. In this example, you can see that the tool tip also explains that I can use the Ctrl+O key combination to open a file.

WPF provides some interesting additions to the basic tool tip control, and that's what I want to discuss today. WPF contains a tool tip control. If you use it in the default mode it looks exactly like the screenshot above. By that I mean it shows a simple floating window with a light background and dark text. In WPF and Silverlight however we can re-template most controls.

Let's start by looking at a basic tool tip in XAML.

Since I'm using the tool tip property of the button I'll get a simple TextBlock based tool tip.

Getting fancy
Now let's add some alternate UI. I'll use the property element syntax to do this.

In this tooltip I choose my SteelBlue background and White foreground brushes. I also add a dropshadow to the ToolTip control. In the body of the tooltip I add a few textblocks and an image control. Here is the result of my new UI.

Adding some transparency
For the last example I'll add another interesting effect. I'm going to set the background of the tooltip to transparent and also adjust the opacity level of image. As a result, the tool tip will look like it has no borders and you'll be able to see the underlying UI through the tool tip.

Really the sky is the limit when it thinking about tooltip appearance in WPF. Here are a few items to keep in mind though. Tooltips will not stay on screen indefinitely. They automatically disappear after a few seconds. Also, the user cannot interact with any controls on the tooltip.
This was last published in September 2010

Dig Deeper on Windows Presentation Foundation

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.