New to Telerik UI for WinForms? Start a free 30-day trial
How to show tooltip on disabled element in RibbonBar
Updated over 1 year ago
Environment
| Product Version | 2018.2.621 |
| Product | RadRibbonBar for WinForms |
Problem
When a particular element is disabled the Tooltip and SreeenTip events will not fire and there is no way to show the user why element is disabled.
Solution
Use the MouseMove event and show a custom tooltip when a disabled element is hovered:
C#
RadToolTip toolTip = new RadToolTip();
RadButtonElement prevElement = null;
private void RadRibbonBar1_MouseMove(object sender, MouseEventArgs e)
{
var element = radRibbonBar1.ElementTree.GetElementAtPoint(e.Location) as RadButtonElement;
if (e.Button == MouseButtons.None && element != null && !element.Enabled)
{
if (prevElement != element)
{
toolTip.Show("Disabled because...", Cursor.Position, 2000);
}
prevElement = element;
}
}