Can I explicity show tooltip on Mouse Click event in WPF?

后端 未结 4 1323
谎友^
谎友^ 2020-12-19 03:41

I am showing a Tool Tip when Mouse hovers on Help image.

The xaml is given below:

 

        
4条回答
  •  醉酒成梦
    2020-12-19 03:57

    You can force the tool tip to open by setting ToolTip.IsOpen to true. You can get a reference to the ToolTip object by explicitly constructing one when setting the ToolTip property. Instead of

    
        
        ...
        
    
    

    write

    
        
            
            ...
            
        
    
    

    And then in your MouseUp handler do something like:

    ((ToolTip)((FrameworkElement)sender).ToolTip).IsOpen = true;
    

提交回复
热议问题