There are two ways of doing this:

The first approach is to assign directly the text to be displayed to every ComboBoxItem. This is done through the API or through the design time. You must assign the required text to every item’s ToolTipText.

 

designtime

 

The second approach is to handle the ToolTipTextNeeded event where custom logic can be applied:

private voidTestComboBox1_Load(objectsender, EventArgs e)
{
    ComboPopupForm parent = this.radComboBox1.ComboBoxElement.ListBoxElement.ElementTree.Control asComboPopupForm;
    if(parent != null)
    {
        parent.ToolTipTextNeeded += newTelerik.WinControls.ToolTipTextNeededEventHandler(radComboBox1_ToolTipTextNeeded);
    }
}

Add an event handler to the event of the popup form to listen for the ToolTipTextNeeded event (inside of it the ListBoxElement lives so the form control is responsible for bubbling the tooltip events). This can be done inside the Load event of the form.

The task is to display a "tooltip" only for the second item inside the combobox control and the code is:

 

private void radComboBox1_ToolTipTextNeeded(object sender, Telerik.WinControls.ToolTipTextNeededEventArgs e)
{
RadComboBoxItem item = sender as RadComboBoxItem;
if (item != null)
{
if (this.radComboBox1.Items.IndexOf(item) == 1)
{
e.ToolTipText = "this is the second item";
}
}
}

 

Next I will demonstrate the same functionality but for the RadMultiColumnComboBox control.


About the Author

Nikolay Diyanov

Diyanov is the Product Manager of the Native Mobile UI division at Progress. Delivering outstanding solutions that make developers' lives easier is his passion and the biggest reward in his work. In his spare time, Nikolay enjoys travelling around the world, hiking, sun-bathing and kite-surfing.

Find him on Twitter @n_diyanov or on LinkedIn.

Comments

Comments are disabled in preview mode.