The tooltips are represented by the ToolTip content control. We don’t need to add a ToolTip element. We can set an attached property and the Silverlight platform will create the tool tip automatically.
<UserControl x:Class="SilverlightApplication15.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Canvas> <Button FontSize="22" ToolTipService.ToolTip="This is a Simple Tooltip" Content="OK"></Button> </Canvas> </UserControl>
The following video clip explains this code sample.
We can easily create a customized tool tip by using the ToolTipService.ToolTip associated property.
<UserControl x:Class="SilverlightApplication15.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Canvas> <Button FontSize="22" Content="OK"> <ToolTipService.ToolTip> <StackPanel Orientation="Vertical"> <TextBlock Text="This is The First Text" /> <TextBlock Text="This is The Second Text" /> <TextBlock Text="This is The Third Text" /> <Image Source="mypix.png" /> </StackPanel> </ToolTipService.ToolTip> </Button> </Canvas> </UserControl>
The following video clip explains this code sample.