Adam Jones
Adam Jones

Reputation: 2460

How do I format/style a Tooltip in Silverlight?

Basically I have an image in my application that I want to add hover text (or tool tip) too. This is easy to do using the ToolTipService.ToolTip attribute on the Image tag. The problem I have is that I require some words in the text to have a font-weight of bold.

i.e. This is a test tooltip.

My image tag looks something like this:

<Image Name="HelpIcon" Height="16" Width="16" Source="component/Assets/help.png" Stretch="Uniform" ToolTipService.ToolTip="This is a test tooltip.">

So given this example, how do I make the word test appear bold in the tooltip?

Upvotes: 0

Views: 1053

Answers (1)

ShawnFeatherly
ShawnFeatherly

Reputation: 2638

For the tooltip to have rich content you need to define the ToolTip contents as FrameworkElements rather than text.

<Image Source="component/Assets/help.png">
    <ToolTipService.ToolTip>
        <TextBlock>
            This is a <Bold>test</Bold> tooltip.
        </TextBlock>
    </ToolTipService.ToolTip>
</Image>

Upvotes: 1

Related Questions