Over a million developers have joined DZone.

Silverlight ToolTips – Positioning and Customizing

·

Customizing

The end all be all definitive guide on how to customize a ToolTip is Dave Relyea’s post.  He shows a very clean and concise step by step on how to completely change the visuals of a ToolTip.  http://blogs.msdn.com/devdave/archive/2008/10/18/customizing-a-tooltip.aspx

Positioning

Positioning a ToolTip can be done with HorizontalOffset and VerticalOffset.  The biggest drawback is the inability to place the tooltip exactly where you want through XAML.  It can be done by wiring up a MouseEnter event for the ToolTip and then calculating the offsets.

<Button x:Name="InfoButton" Content="info" Width="50" Height="25">

<ToolTipService.ToolTip>

<ToolTip HorizontalOffset="-40" VerticalOffset="-140">

<ToolTip.Content>

<Grid Width="70">

<Rectangle Fill="Blue" />

<TextBlock TextWrapping="Wrap" Foreground="White"
Text="Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam mattis," />

</Grid>

</ToolTip.Content>

</ToolTip>

</ToolTipService.ToolTip>

</Button>

Notice the nested ToolTip inside the ToolTipService.  This is where you set the horizontal and vertical offsets for the Tooltip.

 

Topics:

Published at DZone with permission of Corey Schuman, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}