wpf tooltips -set duration across application

2019-04-09 04:51发布

问题:

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.

回答1:

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));
    }

}

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



标签: wpf tooltip