Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
725
UltraGrid Mouse Hover
posted

Hi!

How do I get the cell on which the mouse hovers?

And after that, how do I set the tooltip I want to show?

I'm using Visual Studio.

Thanks

  • 469350
    Verified Answer
    Offline posted

    Hi Mariela,

    If you just want to show a tooltip on a cell, then the simplest way to do that is via the ToolTipText property of the cell. Typically, you would set this property in the InitializeRow event of the grid.

    If you need more control than that and want to set up the tooltip as the mouse is moving, then you can determine which cell the mouse is over using the UIElements. Here's a KB article with sample code:

    HOWTO:UltraWinGrid Mouse Position and Cell Identification

    You will probably want to use the MouseMove event of the grid for this.

    Showing the tooltip at that point is a matter of using either the ToolTip class (which is part of the DotNet framework) or the UltraToolTipManager (which is part of the Infragistics suite of controls).

    Tooltips are control-based. In other words, when you show a tooltip, you are showing a tooltip for the whole control, not for a single cell. And there's all kinds of functionality that handles hiding the tooltip when the mouse leaves a control that will not take effect if you are showing a tooltip for a cell, so you will have to handle hiding the tooltips as well as showing them if you take this approach.

    But like I said, using the ToolTipText property of the cell is a lot easier and it will handle showing and hiding the tooltips for you.