Click here to Skip to main content
15,890,670 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to show tooltip for WPF ComboBox items. ComboBox using is from PresentationFramework.dll. I am not using XAML. Please suggest the event that need to be raised, when we hover the mouse on ComboBox Items.

What I have tried:

MouseMove event doesnot trigger when we move cursor on combobox items.
Posted
Updated 22-Dec-16 0:06am

1 solution

Try this (no guarantees):

XML
<ComboBox >
    <ComboBox.ToolTip>
        <ToolTip DataContext="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Self}}">
            <TextBlock Text="{Binding SelectionBoxItem}"/>
        </ToolTip>
    </ComboBox.ToolTip>
</ComboBox>


To see when the tooltip opens, try something like this:
C#
myCombo.Tooltip.Opened += new RoutedEventHandler(ToolTip_Open);
myCombo.Tooltip.Closed += new RoutedEventHandler(ToolTipClosed);
 
Share this answer
 
Comments
santhosh576 23-Dec-16 0:39am    
I am not using XAML. I am writing a custom class which inherits ComboBox. And this Custom ComboBox has ComboBox items, where we need to display tooltip for each item, when mouse hovers on each item.
Kalkidas 25-Jan-24 9:59am    
Works like a charm.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900