How to override tooltip of combobox item

2 posts, 0 answers
  1. Monica
    Monica avatar
    1 posts
    Member since:
    Jun 2017

    Posted 11 Jun Link to this post

    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.

  2. Dinko
    Admin
    Dinko avatar
    416 posts

    Posted 14 Jun Link to this post

    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 allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top