Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > ComboBox > Custom tool tip

Answered Custom tool tip

Feed from this thread
  • Kristjan Einarsson avatar

    Posted on Sep 13, 2011 (permalink)

    Hi,
    I is there a way to have custom tool tips for each comboboxitem in the combobox ?

    <telerik:RadComboBox Name="comboWorkingPlan" Height="20" Width="100"
    DisplayMemberPath="Name"
    SelectionChanged="comboWorkingPlan_SelectionChanged"
    SelectedItem="{Binding Source={StaticResource MainUIDataSource}, Path=Class, Mode=TwoWay}"
    ItemsSource="{Binding Source={StaticResource MainUIDataSource}, Path=PlansDataSource.AllClasses}" Initialized="comboWorkingPlan_Initialized"/>

    Lets say I have a property called "Description" for each Class, would I be able to display that as a tooltip ?

    Cheers
    Kristján

    Reply

  • Answer Pana Pana admin's avatar

    Posted on Sep 16, 2011 (permalink)

    Hi,

    It is possible using ItemContainerStyle and applying ToolTip in a Setter there bound to a property of your view model. Please refer to the attached project.

    Greetings,
    Pana
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
    Attached files

    Reply

  • Kristjan Einarsson avatar

    Posted on Sep 16, 2011 (permalink)

    Thank you :)

    Reply

  • Siva Prakash avatar

    Posted on Dec 23, 2011 (permalink)

    Hi,

    In my project, I am facing one problem with the tooltip of the radcomboBox. It's like this -->

    I want to show a tooltip which displays the ID of the item when focus is placed on the combobox item.
    And also I am able to achieve this one perfectly. But what the problem I am facing now is -  The ComboBox items are not getting displayed in the container. Please help me out in resolving this.

    Regards
    K Siva Prakash.

    Reply

  • Siva Prakash avatar

    Posted on Dec 23, 2011 (permalink)

    This is my code snippet.

    <
    telerik:RadComboBox HorizontalAlignment="Center" 
                                              VerticalAlignment="Center"  
                                              Width="283" 
                                              ItemsSource="{Binding Items}"
                                              DisplayMemberPath="Name" 
                                              SelectedValuePath="Id" 
                                              SelectedValue="{Binding Path=SelectedItem, Mode=TwoWay}" 
                                              Margin="100,100">
                <telerik:RadComboBox.ItemContainerStyle>
                    <Style TargetType="telerik:RadComboBoxItem">
                        <Setter Property="Content" Value="{Binding Name}"/>
                        <Setter Property="ToolTip" Value="{Binding Id}"/>
                    </Style>
                </telerik:RadComboBox.ItemContainerStyle>
            </telerik:RadComboBox>

    Reply

  • Dani Dani admin's avatar

    Posted on Dec 23, 2011 (permalink)

    Hi Siva Prakash,

    Please try the following XAML snippet instead. I believe you have a wrong Binding and a missing SelectionBoxTemplate.

    <Window.Resources>
            <DataTemplate x:Key="SelectionBoxTemplate">
                <TextBlock Text="{Binding Id}" />
            </DataTemplate>
        </Window.Resources>
        <Grid>
            <telerik:RadComboBox HorizontalAlignment="Center" 
                                 VerticalAlignment="Center"  
                                 Width="283"
                                 ItemsSource="{Binding}" 
                                 SelectionBoxTemplate="{StaticResource SelectionBoxTemplate}"
                                 Margin="100,100">          
                <telerik:RadComboBox.ItemContainerStyle>
                    <Style TargetType="telerik:RadComboBoxItem">
                        <Setter Property="Content" Value="{Binding Name}"/>
                        <Setter Property="ToolTip" Value="{Binding Id}"/>
                    </Style>
                </telerik:RadComboBox.ItemContainerStyle>           
            </telerik:RadComboBox>
        </Grid>

    I hope this will help solve your issue.

    Kind regards,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

  • Siva Prakash avatar

    Posted on Dec 23, 2011 (permalink)

    Hi,

    Reply

  • Siva Prakash avatar

    Posted on Dec 23, 2011 (permalink)

    Hi,

    Actually I am able to show the seleted value in the comboBox. It's not the problem what I am facing. Please see the attached image.
    I am not able to see the items in the Collection container of RadComboBox. Here Binding of the selectedValue is must for me. I can't remove that one from the xaml.
    Please look at this and provide me a solution. I tried to send a sample code. But I am not knowing how to send. Tell me how to send a sample code. If you require, then I will send it.


    Thanks & Regards
    K Siva Prakash.
    Attached files

    Reply

  • Dani Dani admin's avatar

    Posted on Dec 27, 2011 (permalink)

    Hi Siva,

    Please, use either the DisplayMemberPath property or the Content property setter in the ItemContainerStyle. Using both results in your items not being shown.

    Try the following:
    <telerik:RadComboBox HorizontalAlignment="Center" 
                                              VerticalAlignment="Center"  
                                              Width="283" 
                                              ItemsSource="{Binding}"   
                                              DisplayMemberPath="Name"
                                              SelectedValuePath="Id" 
                                              SelectedValue="{Binding Path=SelectedItem, Mode=TwoWay}" 
                                              Margin="100,100">
                <telerik:RadComboBox.ItemContainerStyle>
                    <Style TargetType="telerik:RadComboBoxItem">                    
                        <Setter Property="ToolTip" Value="{Binding Id}"/>
                    </Style>
                </telerik:RadComboBox.ItemContainerStyle>
            </telerik:RadComboBox>

    I hope this will be helpful.

    Kind regards,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

  • Siva Prakash avatar

    Posted on Dec 27, 2011 (permalink)

    Hi Dani,

    The previous solution resolved my issue. Thanks for that.

    Regards
    K Siva Prakash.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > ComboBox > Custom tool tip
Related resources for "Custom tool tip"

WPF ComboBox Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]