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
80
Ultragrid tooltip won't reshow
posted

I'm dynamically setting the tooltip for a grid depending on which rows are selected. The problem is I have to click away from the grid after I select the rows and then move the mouse back over the grid for the tool tip to display.

private void _toolTip_Popup(object sender, PopupEventArgs e)
{        	
    if (e.AssociatedControl != CurveGrid)
    {
        e.Cancel = true;
        return;
    }

    var dates = CurveGrid.Selected.Rows.All.Cast<UltraGridRow>()?.Select(r => r.GetCellValue("Date")).OfType<DateTime>().ToList();
    if (dates.Any())
    {               
        _toolTip.Popup -=_toolTip_Popup;
        _toolTip.SetToolTip(CurveGrid, $"CUSTOM TEXT GOES HERE");
        _toolTip.Popup +=_toolTip_Popup;
    }
    else
    {
        e.Cancel = true;
    }
}

Parents
No Data
Reply
  • 2155
    Offline posted

    Hello Steve,

    If you assign a tooltip to a control, then it works via the MouseHover event. This event will only fire once when the mouse moves into the control and stays there for a certain interval, and it will not fire again until the mouse leaves the control and comes back in. So you really cannot use SetToolTip like this to show a tooltip for a part of a control like a row.

    If you would like a dynamic tooltip, I suggest you take a look at a sample implementation of UltraToolTipManager in the product sample at '\Samples\Legacy\Misc\CS\ToolTipManager\ToolTips with Context CS'.

    I have also created a sample that demonstrates the usage of UltraToolTipManager. In the attached sample, I set up a tooltip at UltraGrid's MouseEnterElement and show the number of current selected rows if there are more than one rows are selected.

    UltraGrid_Tooltip.zip

Children
No Data