SelectionBox with ItemTemplate and IsEditable

2 posts, 0 answers
  1. Andreas
    Andreas avatar
    14 posts
    Member since:
    Feb 2011

    Posted 27 May 2011 Link to this post

    Hello!

    We have the following problem:
    We want to have an editable combobox which shows items with an ItemTemplate. But when we use the TextSearch.TextPath Property only the choosen path will be displayed in the selection box. But we want to display the items as defined in the itemtemplate with further support of searching with isEditable=true.

    Thanks for your help.

    <UserControl.Resources>
            <DataTemplate x:Key="CustomItemTemplate">
                <StackPanel Margin="0 3" Orientation="Horizontal">
                    <TextBlock Text="{Binding Surname}" />
                    <TextBlock Text="{Binding Firstname}" Margin="4,0,0,0" />
                </StackPanel>
            </DataTemplate>
        </UserControl.Resources>
    <telerikInput:RadComboBox Grid.Column="1"
                                                              Grid.Row="0"
                                                              x:Name="cbxHead"
                                                              Margin="0,1"
                                                              ItemsSource="{Binding Path=EmpColl}"
                                                              SelectedItem="{Binding Path=Head, Mode=TwoWay, ValidatesOnNotifyDataErrors=True}"
                                                              TextSearchMode="StartsWith"
                                                              IsFilteringEnabled="True"
                                                              IsEditable="False"
                                                              IsReadOnly="True"
                                                              ItemTemplate="{StaticResource CustomItemTemplate}"
                                                              StaysOpenOnEdit="True"
                                                              telerik:TextSearch.TextPath="Surname">
                                    </telerikInput:RadComboBox>

  2. Dani
    Admin
    Dani avatar
    848 posts

    Posted 30 May 2011 Link to this post

    Hi Andreas,

    By default the template of the selected item in RadComboBox indeed is the path of the binding only. If you want to apply different data formatting , you are probably fimiliar with the fact that this is done via the SelectionBoxTemplate. However, the SelectionBoxTemplate is applicable only when the RadComboBox is IsEditable="False". And it is not possible to change the visualization of the selected item when IsEditable="True".
     
    In fact, this is an intended and quite normal behavior. Imagine you have a few other controls in your selection template and when you put your cursor in the editable combo, you are practically editing a few controls.

    I would suggest that you try to find a different approach that fits your control editing scenario. I hope this helps.

    Best wishes,
    Dani
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
Back to Top