This is a migrated thread and some comments may be shown as answers.

How to override tooltip of combobox item

1 Answer 373 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Monica
Top achievements
Rank 1
Monica asked on 12 Jun 2017, 04:49 AM

Hello,

I have a combobox on which i am trying to modify the default tooltip style.This is applicable when I am hovering on individual combobox items and I should get the tooltip. Right now for tooltip , we are showing up the text value. But I want to override this deafult style and show the description instead. (Note that description is a user defined property).

The code snippet right now is:

<Style.Resources>
            <Style TargetType="{x:Type ComboBoxItem}" BasedOn="{StaticResource ComboBoxItemStyle}">
                <!--<Setter Property="ToolTip" Value="{Binding ToolTipDescription, Mode=TwoWay}"/>-->
                <Setter Property="ToolTip" Value="{Binding}"/>
            </Style>
        </Style.Resources>

 

Here while setting the property "tooltip" <Setter Property="ToolTip" Value="{Binding ToolTipDescription, Mode=TwoWay}"/>. I tried doing something like this. Here I exposed a public property from my class which is holding the description value that I need to show when i am hovering on the individual item. But the binding is not working.

 

I need your input to proceed further.

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 14 Jun 2017, 01:52 PM
Hi Monica,

Thank you for contacting us.

We are not sure that we have fully understood your scenario. Basically, if you want to show different value in the tooltip you can create a property in your model which will hold the description and bind it to the ToolTip property. 

For your convenience, we have created sample project which demonstrates this approach. Give it a try and let us know if it works for you. If not, you can elaborate more on your approach.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
ComboBox
Asked by
Monica
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or