整个工具提示BACKGROUNDCOLOR [英] Backgroundcolor of entire ToolTip
本文介绍了整个工具提示BACKGROUNDCOLOR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有谁知道一个简单的XAML解决方案,以改变工具提示
?
Does anyone know a simple XAML solution to change the entire background of a ToolTip
?
我做的以下内容:
<Image Height="16" Source="Images/Icons/Add2.png" Stretch="Fill" Width="16" Opacity="0.99" Grid.Column="0">
<Image.ToolTip>
<Grid Background="#000000">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Text="Header1" FontSize="15" Grid.Row="0"/>
<TextBlock Text="Subitem" FontSize="12" Grid.Row="1"/>
</Grid>
</Image.ToolTip>
</Image>
但结果看起来像:
But the result looks like that:
有什么建议?
推荐答案
的问题是,所有你真的做的是设置提示的内容,而不是工具提示本身。
The problem is that all you're really doing is setting the CONTENT of the tooltip, not the tooltip itself.
所以,你需要样式工具提示来实现这一目标。有一些方法与资源,做到这一点是在这个岗位看出:
So you'll need to style the tooltip to make this happen. There are some ways to do it with resources as seen in this post:
或你可以改变你的代码来包装的网格明确的工具提示并设置其背景属性:
or you can change your code to wrap that grid with an explicit ToolTip and set its background property:
<Image.ToolTip>
<ToolTip Background="Black">
<Grid>
...
</Grid>
</ToolTip>
</Image.ToolTip>
这篇关于整个工具提示BACKGROUNDCOLOR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文