Forcing a WPF tooltip to stay on the screen

前端 未结 10 1995
别那么骄傲
别那么骄傲 2020-12-08 18:24

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:<

10条回答
  •  醉话见心
    2020-12-08 18:49

    If you want to specify that only certain elements in your Window have effectively indefinite ToolTip duration you can define a Style in your Window.Resources for those elements. Here is a Style for Button that has such a ToolTip :

    
        ...
        
            
            ...
        
        ...
        

    One can also add Style.Resources to the Style to change the appearance of the ToolTip it shows, for example:

    
        
        
    
    

    Note: When I did this I also used BasedOn in the Style so everything else defined for the version of my custom control with a normal ToolTip would be applied.

提交回复
热议问题