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

后端 未结 4 1297
谎友^
谎友^ 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:53
    EventManager.RegisterClassHandler(typeof(Window), Mouse.MouseDownEvent, 
                                      new MouseButtonEventHandler((o, args) => 
                                      { 
                                          if (_popup.IsOpen) 
                                              _popup.IsOpen = false; 
                                      }));
    
    0 讨论(0)
  • 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

    <Image.ToolTip>
        <Grid>
        ...
        </Grid>
    </Image.ToolTip>
    

    write

    <Image.ToolTip>
        <ToolTip>
            <Grid>
            ...
            </Grid>
        </ToolTip>
    </Image.ToolTip>
    

    And then in your MouseUp handler do something like:

    ((ToolTip)((FrameworkElement)sender).ToolTip).IsOpen = true;
    
    0 讨论(0)
  • 2020-12-19 03:58

    OnClick set visibility of tooltip true and in ToolTipClosing set visibility c

    ....

    0 讨论(0)
  • 2020-12-19 04:08

    No you can't invoked the tooltip on mouseclick. Instead of using Tooltip, you can use Popup control. Invoke the Popup Control on mouse click.

    0 讨论(0)
提交回复
热议问题