Radcombobox with ItemTemplate, Filtering, and Searching

2 posts, 0 answers
  1. Jay
    Jay avatar
    4 posts
    Member since:
    Aug 2008

    Posted 24 Aug 2012 Link to this post

    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. Ivo
    Admin
    Ivo avatar
    390 posts

    Posted 30 Aug 2012 Link to this post

    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.

  3. DevCraft banner
Back to Top