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

Radribboncombobox - Type of the selected item is displayed instead of value in 2013.1.220.1050

4 Answers 104 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Rohini
Top achievements
Rank 1
Rohini asked on 09 May 2013, 11:51 AM
When a list is bound to RadComboxBox, the selected item is showing the type instead of actual value.

<Controls:RadRibbonComboBox x:Name="namesCombo">
            <Controls:RadRibbonComboBox.ItemTemplate>
                <DataTemplate>
                    <Border Background="Transparent">
                        <TextBlock Text="{Binding Name}">
                            <UserControls:TooltipHelper.Tooltip>
                                <ToolTip Template="{StaticResource TextToolTipTemplate}" Content="{Binding Description}"/>
                            </UserControls:TooltipHelper.Tooltip>
                        </TextBlock>
                    </Border>
                </DataTemplate>
            </Controls:RadRibbonComboBox.ItemTemplate>
        </Controls:RadRibbonComboBox>

private void SetWriteableTemplates(bool isUserAdmin)
       {
           if (Templates == null) return;
 
           namesCombo.ItemsSource = Templates.Where(t => isUserAdmin || !t.IsSystem).ToList();
           namesCombo.SelectedIndex = 0;
       }

But the selected item will be the type of the list instead of actual value.

The value for Name wont be displayed in selected value.
for eg : The Name property contains certain values and its type is observable collection. Then the selected value will be displayed as that observablecollection

4 Answers, 1 is accepted

Sort by
0
Masha
Telerik team
answered on 14 May 2013, 07:57 AM
Hi Rohini,

Simply add telerik:TextSearch.TextPath="Name" to the RadRibbonComboBox definition and everything should work as expected.

I hope it helps.

Greetings,
Masha
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Rohini
Top achievements
Rank 1
answered on 14 May 2013, 11:16 AM
Adding telerik:TextSearch.TextPath="Name" gives error "TextPath" for TextSearch not found.
Giving only TextSearch.TextPath="Name" doesnt solve the problem
0
Masha
Telerik team
answered on 14 May 2013, 11:28 AM
Hello Rohini,

Did you use the correct namespace for TextSearch.TextPath="Name" ?
I've demonstrated the scenario from my previous post in the attached project. Please review it and let me know what is the difference  when using TextSearch.TextPath property.

I look forward to receiving your reply


Kind regards,
Masha
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Rohini
Top achievements
Rank 1
answered on 20 May 2013, 04:46 AM
I have used the namespace Telerik.Windows.Controls.
Using SelectionBoxTemplate along with the ItemTemplate will solve the issue.

<Controls1:RadRibbonComboBox x:Name="namesCombo" IsEditable="False">
    <Controls1:RadRibbonComboBox.SelectionBoxTemplate>
        <DataTemplate>
            <Border Background="Transparent">
                <TextBlock Text="{Binding Name}">                          
                </TextBlock>
            </Border>
        </DataTemplate>
    </Controls1:RadRibbonComboBox.SelectionBoxTemplate>
    <Controls1:RadRibbonComboBox.ItemTemplate>
        <DataTemplate>
            <Border Background="Transparent">
                <TextBlock Text="{Binding Name}">
                    <UserControls:TooltipHelper.Tooltip>
                        <ToolTip Template="{StaticResource TextToolTipTemplate}" Content="{Binding Description}"/>
                    </UserControls:TooltipHelper.Tooltip>
                </TextBlock>
            </Border>
        </DataTemplate>
    </Controls1:RadRibbonComboBox.ItemTemplate>
</Controls1:RadRibbonComboBox>
Tags
ComboBox
Asked by
Rohini
Top achievements
Rank 1
Answers by
Masha
Telerik team
Rohini
Top achievements
Rank 1
Share this question
or