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.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)




