强制WPF工具提示在屏幕上停留 [英] Forcing a WPF tooltip to stay on the screen

查看:264
本文介绍了强制WPF工具提示在屏幕上停留的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个标签的提示,我希望它继续开放,直到用户
将鼠标移动到不同的控制。

I have a tooltip for a Label and I want it to stay open until the user moves the mouse to a different control.

我曾尝试在提示以下属性:

I have tried the following properties on the tooltip:

StaysOpen="True"

TooltipService.ShowDuration = "60000"

但在这两种情况下,工具提示仅显示了整整5秒。

But in both cases the tooltip is only displayed for exactly 5 seconds.

为什么这些价值被忽略了?

Why are these values being ignored?

推荐答案

只要把初始化本节code。

Just put this code in initialization section.

ToolTipService.ShowDurationProperty.OverrideMetadata(
    typeof(DependencyObject), new FrameworkPropertyMetadata(Int32.MaxValue));

这篇关于强制WPF工具提示在屏幕上停留的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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