【发布时间】:2009-07-22 15:49:06
【问题描述】:
我正在 c# 中创建一个 WPF 应用程序,并且我有一个带有图像的图像控件。当鼠标悬停在ToolTip 上时,我希望它显示带有图像和文本的ToolTip。那么当鼠标悬停在ToolTip 上时,如何使用图像制作ToolTip。在此先感谢您的帮助。
【问题讨论】:
我正在 c# 中创建一个 WPF 应用程序,并且我有一个带有图像的图像控件。当鼠标悬停在ToolTip 上时,我希望它显示带有图像和文本的ToolTip。那么当鼠标悬停在ToolTip 上时,如何使用图像制作ToolTip。在此先感谢您的帮助。
【问题讨论】:
试试这样的。
<!-- This is the image that has the tooltip -->
<Image Source="...">
<Image.ToolTip>
<!-- A tooltip can contain any element. Here we put a text
block and another image. -->
<StackPanel>
<TextBlock>This is the tooltip text</TextBlock>
<!-- This image appears inside the tooltip -->
<Image Source="..." />
</StackPanel>
</Image.ToolTip>
</Image>
【讨论】: