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

RadComboBox type ahead not working when using a ContainerBindingCollection / DataTemplate

2 Answers 101 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Stephen
Top achievements
Rank 1
Stephen asked on 15 Aug 2012, 01:02 PM
I have a combo box that is bound to a collection.  There are some items in that collection that I do not want to be visible in the combo box.  I am using a ContainerBindingCollection / DataTemplate to accomplish this and it works great.  The problem is that type ahead doesn't work.  Could you please let me know how I can resolve this?  My guess is that type ahead is based on DisplayMemberPath, which isn't used in this scenario.

Here is the code for my ContainerBindingCollection and DataTemplate:
<telerik:ContainerBindingCollection x:Name="UserItemBindings">
    <telerik:ContainerBinding Binding="{Binding VisibleState, Mode=TwoWay}" PropertyName="Visibility" />
</telerik:ContainerBindingCollection>
<DataTemplate x:Key="ComboBoxVisibilityTemplate" telerik:ContainerBinding.ContainerBindings="{StaticResource UserItemBindings}">
    <TextBlock Text="{Binding DropDownEntry}" />
</DataTemplate>

Here is the code for my combo box:
<telerik:RadComboBox x:Name="rcbxLocationFavorite"
  Width="200"
  Height="25"
  VerticalAlignment="Center"
  ClearSelectionButtonVisibility="Visible"
  ItemTemplate="{StaticResource ComboBoxVisibilityTemplate}"
  SelectedValuePath="EntryStringId"
  TextSearchMode="Contains"
  ToolTipService.Placement="Top" />

2 Answers, 1 is accepted

Sort by
0
Stephen
Top achievements
Rank 1
answered on 15 Aug 2012, 03:18 PM
I found something I thought would work, but it fixes one problem and causes another.  Using this code for the button makes type ahead work.  The problem it that when you do type ahead, it will consider those hidden values as possible.  So, if you have something hidden and type the first letter of it, it will show up as the selected item (but not visible in the drop down list).

<telerik:RadComboBox x:Name="rcbxLocationFavorite"
  Width="200"
  Height="25"
  VerticalAlignment="Center"
  ClearSelectionButtonVisibility="Visible"
  ItemTemplate="{StaticResource ComboBoxVisibilityTemplate}"
  SelectedValuePath="DropDownEntry"
  telerik:TextSearch.TextPath="DropDownEntry"
  TextSearchMode="Contains"
  ToolTipService.Placement="Top" />
0
Stephen
Top achievements
Rank 1
answered on 15 Aug 2012, 06:28 PM
I figured out a solution for this.  I added another property to my ContainerBindingCollection, which disables the item.  So, the one property stops it from being selected and the second stops it from being seen.

<telerik:ContainerBindingCollection x:Name="UserItemBindings">
  <telerik:ContainerBinding Binding="{Binding Show, Mode=TwoWay}" PropertyName="IsEnabled" />
  <telerik:ContainerBinding Binding="{Binding VisibleState, Mode=TwoWay}" PropertyName="Visibility" />
</telerik:ContainerBindingCollection>
<DataTemplate x:Key="ComboBoxVisibilityTemplate"
  telerik:ContainerBinding.ContainerBindings="{StaticResource UserItemBindings}">
<TextBlock Text="{Binding DropDownEntry}" />
Tags
ComboBox
Asked by
Stephen
Top achievements
Rank 1
Answers by
Stephen
Top achievements
Rank 1
Share this question
or