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

Radcombobox with ItemTemplate, Filtering, and Searching

2 Answers 456 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 24 Aug 2012, 09:09 PM

I started from the example in the demos.

Basically what is happening is that the template items render fine. Just when filtering is enabled everything disappears. Selecting the Item instead of typing causes the value to display the class type, not the TextSearch.TextPath.

What am I missing here?

<DataTemplate x:Key="ComboBoxCustomTemplate">
    <Grid Margin="0 3">
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>
        <TextBlock Grid.Row="0">
            <Run Text="{Binding Distributor}"></Run>
            <Run >(</Run>
            <Run Text="{Binding Country}"></Run>
            <Run>)</Run>
        </TextBlock>
        <TextBlock Grid.Row="1" Foreground="LightGray" FontSize="10" Text="{Binding Region}" />
    </Grid>
</DataTemplate>


<telerik:RadComboBox x:Name="DistributorTextBox" Grid.Column="1" Grid.Row="2" ItemsSource="{Binding DistributorData}" VerticalAlignment="Center" EmptyText="Select Distributor" IsEditable="True"  Cursor="Hand" telerik:StyleManager.Theme="Windows7" Height="30" IsFilteringEnabled="True"  OpenDropDownOnFocus="True" TextSearchMode="StartsWith"  TextSearch.TextPath="Distributor" ItemTemplate="{StaticResource ComboBoxCustomTemplate}"  CanAutocompleteSelectItems="False"   />


I noticed that if I rip out the template, everything works as expected (filtering and selecting).

2 Answers, 1 is accepted

Sort by
0
Ivo
Telerik team
answered on 30 Aug 2012, 07:33 AM
Hi Jay,

Using the telerik:TextSearch.TextPath attached property instead of the TextSearch:TextPath will do the trick into your case. The RadComboBox is designed to be used with Telerik's attached property instead of the Silverlight's one. 

Regards,
Ivo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Don
Top achievements
Rank 1
answered on 05 Jun 2020, 06:23 PM

Hello,

I am implementing something similar, except I am using the ComboBoxFilteringBehavior.

The reason is that I need to search to look at both the "Distributor" and the "Country" 

the issue that arises is that everything works well until you SELECT an ITEM.

The text that gets placed into the TEXT is the Model.ToString()... NOT the DataTemplate that we use for the ItemTemplate.

Is there a way to fix this? or work around this without making changes to the Model?

Thanks,

Don

 

 

Tags
ComboBox
Asked by
Jay
Top achievements
Rank 1
Answers by
Ivo
Telerik team
Don
Top achievements
Rank 1
Share this question
or