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

5 posts, 0 answers
  1. Rohini
    Rohini avatar
    3 posts
    Member since:
    Apr 2011

    Posted 09 May 2013 Link to this post

    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
  2. Masha
    Admin
    Masha avatar
    355 posts

    Posted 14 May 2013 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Rohini
    Rohini avatar
    3 posts
    Member since:
    Apr 2011

    Posted 14 May 2013 Link to this post

    Adding telerik:TextSearch.TextPath="Name" gives error "TextPath" for TextSearch not found.
    Giving only TextSearch.TextPath="Name" doesnt solve the problem
  5. Masha
    Admin
    Masha avatar
    355 posts

    Posted 14 May 2013 Link to this post

    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.

  6. Rohini
    Rohini avatar
    3 posts
    Member since:
    Apr 2011

    Posted 19 May 2013 Link to this post

    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>
Back to Top
UI for WPF is Visual Studio 2017 Ready