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
705
controlling tooltip width
posted

Is there a way on the ultragrid (or wingrid) to set the tooltip width so that it only fits to the width of the column that is being hovered over?  Currently it expands to the entire screen and I have some users who were wondering if this could be altered.

Any examples are certainly appreciated (C#).

 

Thanks!

Parents
No Data
Reply
  • 69832
    Suggested Answer
    Offline posted

    Our ToolTipInfo struct, which the grid uses to display the cell tooltips, exposes a 'MaxWidth' property, which allows you to restrict the width, but not force it any bigger. You could use this mechanism to prevent the tooltip width from getting any larger than the width of the column, but you would not be able to force it to that with when there is not enough text in the tooltip.

    There is no publicly exposed property or event that gives you access to this struct, but I think you might be able to work around that. The UIElement class exposes a settable property, ToolTipItem, which is of type Infragistics.Win.IToolTipItem, so you could use the IUIElementCreationFilter interface (handle the AfterCreateChildElements method) to intercept the initialization of these elements, and then set the ToolTipItem property of the CellUIElements to a class that implements the IToolTipItem interface. That interface only exposes one method, GetToolTipInfo, which passes you a reference to the CellUIElement, and a ToolTipInfo struct.

    You may have arrived at the conclusion by now that this is too much work for the requirement, so you might alternatively want to submit a feature request for a property that allows you to control this.

Children