Project DescriptionThis Silverlight ToolTipService makes it easier to set tooltips on Silverlight controls with a specified delay and display duration. It's developed in C# and delivered as a Silverlight library.
You can set initial delay, fade-out and display duration properties of a ToolTip.
IntroductionIt surprised me that a simple option like setting the display time or the initial delay of a ToolTip is still not possible in Silverlight, although these properties are present in their WPF counterpart.
Sometimes, you want some custom ToolTip behavior:
for instance, some ToolTips need to persist as long as the control has focus, or others need a specific display duration (for example 10 seconds), or should only show up after an initial delay of 3 seconds.
The default Silverlight setting is a display time of 5 seconds, and then it’s gone until you mouse out and mouse over the control again.
Optionally, you can also set a custom Storyboard that is triggered when a ToolTips opens or closes, using the OpenAnimation and CloseAnimation properties.
Since Silverlight already provides us with a static ToolTipService class that takes care of the basic ToolTip functionality, I thought it was a good idea to extend its behavior a bit.
Initially.
It didn't take me long until I hit some MS internal exceptions.
FeaturesThat’s how I ended up creating the following
custom ToolTipService and
custom ToolTip class.
It provides
new ToolTip behaviors:
- you can set persistent ToolTips: duration = until mouse out (DisplayTime = int.MaxValue)
- you can specify the amount of seconds the ToolTip should display (DisplayTime property)
- you can specify a Storyboard to be triggered when a ToolTip opens (OpenAnimation property)
- you can specify a Storyboard to be triggered when a ToolTip closes (CloseAnimation property)
- you can specify an initial delay for the ToolTip (InitialDelay property)
- you can databind the ToolTip content
ReleaseLatest release:
Advanced ToolTipService v2.1.1How to useIf you download the source code (
Advanced ToolTipService v2.1.1), you'll have a demo Silverlight application that explains the use of of this library, both from within XAML and in C# code.
Take a look at the sample application
here).
There is also a great video tutorial to be found
here.
For more documentation on this library, please visit the
Documentation tab, or visit my
blog for the latest news.
For the moment being, this solution fit’s to provide this behavior.
Ofcourse, if anyone has a better solution for this, please feel free to point us in the right direction with your suggestions and/or remarks.
If you like it, please vote for it on
Silverlight Uservoice.
Above all, have fun with Silverlight and I wish you impactful developments!