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

SelectionBox with ItemTemplate and IsEditable

1 Answer 65 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Andreas
Top achievements
Rank 1
Andreas asked on 27 May 2011, 10:51 AM
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>

1 Answer, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 30 May 2011, 07:55 AM
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
Tags
ComboBox
Asked by
Andreas
Top achievements
Rank 1
Answers by
Dani
Telerik team
Share this question
or