Creating Tooltips in Silverlight PRO

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.

Share:

banner for the css playlist in hebrew life michael courses for programmers

The First Steps in CSS

Learn CSS using our our videos (in Hebrew) on the CSS (he) playlist on youtube. Do it now. Do it for free.

Good Trainers Collaborate with Others

It is always essential to keep an open mind and learn from others. This applies to everyone, including teachers and especially software development trainers. Software

The Beauty of Code

Coding is Art! Developing Code That Works is Simple. Develop Code with Style is a Challenge!

Update cookies preferences