#864 – Changing the Look of a ToolTip with a Control Template
July 16, 2013 Leave a comment
You can change the content of a ToolTip if you want it to display more than simple text. If you want to go further and change the look of the ToolTip more completely, you can use a control template. This lets you display the tooltip’s content in something other than the default bordered popup.
The example below displays a ToolTip with a custom border and background.
<Button Content="Caesar" Margin="5" Padding="10,5" HorizontalAlignment="Center"> <Button.ToolTip> <ToolTip Content="Click to learn more about Julius Caesar (100 BC - 44 BC)" OverridesDefaultStyle="True" HasDropShadow="True"> <ToolTip.Template> <ControlTemplate TargetType="ToolTip"> <Border BorderBrush="Blue" BorderThickness="1" Background="AliceBlue" CornerRadius="5"> <StackPanel Orientation="Horizontal"> <Image Source="Caesar.jpg" Height="100"/> <TextBlock Text="{TemplateBinding Content}" Margin="10" Width="150" TextWrapping="Wrap"/> </StackPanel> </Border> </ControlTemplate> </ToolTip.Template> </ToolTip> </Button.ToolTip> </Button>