如何以编程方式显示WPF / C#Windows.Control.ToolTip? [英] How to Programmatically show a WPF/C# Windows.Control.ToolTip?

查看:133
本文介绍了如何以编程方式显示WPF / C#Windows.Control.ToolTip?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于Windows.Control.ToolTip,似乎没有一种.Show()方法,其中包括ToolTipService中的方法。

There doesn't seem to be a .Show() kind of method for the Windows.Control.ToolTip, incl in ToolTipService.

推荐答案

您需要做的是确保控件上的工具提示类型为工具提示。然后,您可以像这样将IsOpen属性设置为true:

What you need to do is make sure the ToolTip on the control is of type ToolTip. Then you can set the IsOpen property to true like so:

ToolTip tooltip = new ToolTip{ Content = "My Tooltip" };
NameTextBox.ToolTip = tooltip;
tooltip.IsOpen = true;    

这篇关于如何以编程方式显示WPF / C#Windows.Control.ToolTip?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆