Nerdynosaur
Nerdynosaur

Reputation: 1888

Different foreground in tooltips

may i know how change the foreground of a specific word in my tooltip? I want to change the "RED" words to colors.Red; Note that, all the remaining words in the tooltip should remain black color. Any can help?

XAML code snippet:

<Button Name="myBtn" Content="Click" ToolTip="Click this to change
 the text to RED Color" Click="myBtn_Click"/>

Upvotes: 0

Views: 1728

Answers (1)

vadim
vadim

Reputation: 1726

It's easy can be achieved:

<Button Name="myBtn" Content="Click" Click="myBtn_Click">
    <Button.ToolTip>
        <TextBlock>
            <Run>Click this to change the text to </Run>
            <Run Foreground="Red">RED</Run>
            <Run> Color</Run>
        </TextBlock></Button.ToolTip>
    Test
</Button>

Upvotes: 5

Related Questions