WynApse Home Page
Home    Blog    About    Contact       
Latest Article:


My Tags:
My Sponsors:






Lifetime Member:

<Silverlight Tooltip Number="003" Text="Tooltips" />



After I had done a reasonably large application with tooltips, I realized there might be a better way to deal with them. Since time has passed and Silverlight has grown a bit, there are additional things to consider, but I think the basic concept is still valid.

You want your tooltip to be presented to your user above everything surrounding it. If you ignore ZIndex for a moment, placing your Tooltip canvases at the bottom of your xaml file will make them be 'on top'. Simply setting them to Visibility "Collapsed" in the xaml file, setting them to "Visible" in a MouseEnter, and back to "Collapsed" in MouseLeave will give you a very nice display.

If you need to build your Tooltip at run-time, you can still use this technique by placing an empty "Tooltip" canvas at the bottom of the xaml file, then using createFromXaml to add your tooltip text onto that canvas in MouseEnter, and clearing that canvas in MouseLeave. This is the method I used in my GlyphMap Utility, and it appears to be very responsive even considering all the work that's going on!

Canvas.ZIndex

If I wanted to do either of the above techniques in an application with mixed ZIndex values, I'd set the Canvas.ZIndex of the tooltip canvas to be some value greater than anything else would ever become, or just pick a number such as 1000 for instance ... that should take care of most applications :)
Copyright © 2006-2017, WynApse