工具提示中的不同前景

007*_*070 0 wpf tooltip

我可以知道如何更改工具提示中特定单词的前景吗?我想把“RED”字样改为colors.Red; 请注意,工具提示中的所有剩余单词应保持黑色。有谁可以帮忙吗?

XAML代码片段:

<Button Name="myBtn" Content="Click" ToolTip="Click this to change
 the text to RED Color" Click="myBtn_Click"/>
Run Code Online (Sandbox Code Playgroud)

小智 5

很容易就能实现:

<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>
Run Code Online (Sandbox Code Playgroud)