Silverlight 3 Advanced ToolTipService v2.0.0 released

This is a major release, meaning that lots of effort has gone into optimizing existing features and adding new ones into the library. This caused also some breaking changes, but I'm sure you'll like them.

If you like it, please vote for it on Silverlight Uservoice, and who knows, it might eventually end up in a next version of Silverlight, because in the end, we all prefer built-in features instead of third-party references.

Changelog

New Features

  • Support for browser zooming: the browser zoom factor is now part of the placement-calculation of the ToolTips
  • Support for ToolTip.Placement and ToolTip.PlacementTarget properties
  • ToolTip.DisplayTime and ToolTip.InitialDelay have a better granularity: you can set a Duration instead of an Integer
  • ToolTip.OpenAnimation property: you can set your own Storyboard to attach an animation to the ToolTip Open event
  • ToolTip.CloseAnimation property: you can set your own Storyboard to attach an animation to the ToolTip Close event

Existing Features

  • Support for databinding to the ToolTip.Content property
  • ToolTip.DisplayTime property: you can set the Duration for the ToolTip to display
  • ToolTip.InitialDelay property: you can set the Duration of the delay before the ToolTip should open

Breaking Changes

  • ToolTip.ShowDuration got renamed to ToolTip.DisplayTime
  • ToolTip.DisplayTime is now of type Duration (used to be of type Integer)
  • ToolTip.InitialDelay is now of type Duration (used to be of type Integer)
  • ToolTip.FadeOutDuration property got removed to make place for the more useful OpenAnimation and CloseAnimation properties

How to

Set persistent ToolTips

To create a persistent ToolTip, you typically want to set the duration of the DisplayTime property to Duration.Forever. This can easily be done by code:

toolTip.DisplayTime = Duration.Forever; 
Or:
toolTip.SetValue(ToolTip.DisplayTimeProperty, Duration.Forever); 
## Set advanced ToolTips in XAML Below you find an overview of how to set advanced ToolTip properties in XAML.
<Controls:ToolTipService.ToolTip>

<!-- Set the ToolTip display time and initial delay -->
<Controls:ToolTip DisplayTime="00:00:10" InitialDelay="00:00:03" x:Name="greenTooltip">

<!-- Set the ToolTip close animation -->
<Controls:ToolTip.CloseAnimation>
     <Storyboard Duration="00:00:01">
          <DoubleAnimation From="1" To="0" Storyboard.TargetName="greenTooltip" Storyboard.TargetProperty="Opacity" />
     </Storyboard>
</Controls:ToolTip.CloseAnimation>

<!-- Set the ToolTip open animation -->
<Controls:ToolTip.OpenAnimation>
     <Storyboard Duration="00:00:01">
          <DoubleAnimation From="0" To="1" Storyboard.TargetName="greenTooltip" Storyboard.TargetProperty="Opacity" />
     </Storyboard>
</Controls:ToolTip.OpenAnimation>

<!-- Set the ToolTip content -->
<Controls:ToolTip.Content>
     <StackPanel Margin="5" >
          <TextBlock Text="This tooltip has a DisplayTime of 10 seconds." />
          <TextBlock Text="You can put whatever xaml you want in here..." />
     </StackPanel>
</Controls:ToolTip.Content>

</Controls:ToolTip>

</Controls:ToolTipService.ToolTip>

Of course, you can do the same in code.

Sharing is caring

Posted by Xavier Decoster on
Last revised: 17 May, 2013 09:49 AM
blog comments powered by Disqus