wpf 工具提示 - 跨应用程序设置持续时间 [英] wpf tooltips -set duration across application

查看:29
本文介绍了wpf 工具提示 - 跨应用程序设置持续时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在单个控件工具提示上设置属性,例如持续时间.但我需要的是为整个应用程序中的所有工具提示设置更长的持续时间 - 所有窗口,所有用户控件等.有没有什么干净的方法来实现它?谢谢.

I can set properties on single control tooltip like duration. But what i need is to set longer duration for ALL tooltips in entire application - all windows, all user controls etc. Is there any clean way to achieve it? Thank you.

推荐答案

您可以像这样覆盖 ToolTipService.ShowDurationProperty 的元数据:

You can override the meta-data for the ToolTipService.ShowDurationProperty like so:

public partial class App : System.Windows.Application {

    static App() {
        ToolTipService.ShowDurationProperty.OverrideMetadata(typeof(UIElement),
            new FrameworkPropertyMetadata(1000));
    }

}

以上将使所有 UIElements 的 ToolTip 持续时间为 1 秒.

The above will make the ToolTip duration 1 second for all UIElements.

这篇关于wpf 工具提示 - 跨应用程序设置持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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