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.
Requires Free Membership to View
When you register, you'll begin receiving targeted emails from my team of award-winning writers. Our goal is to provide a unique online resource for developers, architects and development managers tasked with building and maintaining enterprise applications using Visual Basic, C# and the Microsoft .NET platform.
Hannah Smalltree, Editorial DirectorAdding 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.
This was first published in September 2010