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

Custom tool tip

9 Answers 293 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Kristjan Einarsson
Top achievements
Rank 1
Kristjan Einarsson asked on 13 Sep 2011, 02:15 PM
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

9 Answers, 1 is accepted

Sort by
0
Accepted
Pana
Telerik team
answered on 16 Sep 2011, 09:55 AM
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 >>
0
Kristjan Einarsson
Top achievements
Rank 1
answered on 16 Sep 2011, 10:38 AM
Thank you :)
0
Siva Prakash
Top achievements
Rank 1
answered on 23 Dec 2011, 06:37 AM
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.
0
Siva Prakash
Top achievements
Rank 1
answered on 23 Dec 2011, 06:44 AM
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>
0
Dani
Telerik team
answered on 23 Dec 2011, 01:08 PM
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 >>
0
Siva Prakash
Top achievements
Rank 1
answered on 23 Dec 2011, 08:58 PM
Hi,
0
Siva Prakash
Top achievements
Rank 1
answered on 23 Dec 2011, 09:09 PM
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.
0
Dani
Telerik team
answered on 27 Dec 2011, 12:08 PM
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 >>
0
Siva Prakash
Top achievements
Rank 1
answered on 27 Dec 2011, 06:28 PM
Hi Dani,

The previous solution resolved my issue. Thanks for that.

Regards
K Siva Prakash.
Tags
ComboBox
Asked by
Kristjan Einarsson
Top achievements
Rank 1
Answers by
Pana
Telerik team
Kristjan Einarsson
Top achievements
Rank 1
Siva Prakash
Top achievements
Rank 1
Dani
Telerik team
Share this question
or