Filter using RadComboBox

6 posts, 0 answers
  1. Keith
    Keith avatar
    88 posts
    Member since:
    May 2007

    Posted 10 Sep 2010 Link to this post

    Hi

    I'm trying to implement a filter using the RadComboBox but implementing the type-ahead functionality as shown here which brings back a subset of matching entries from a table of around 13,000 rows. Unfortunately I cannot get this to work when used as a custom template within the DataFilter control. I presume because the way it's implemented would mean having two datacontexts. Do you have any sample code showing how to implement this functionality?

    Thanks
    Keith
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 10 Sep 2010 Link to this post

    Hi Keith Pilkington,

    Are you referring the combo that holds the item properties (the left one) or an editor combo?

    All the best,
    Ross
    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
  4. Keith
    Keith avatar
    88 posts
    Member since:
    May 2007

    Posted 11 Sep 2010 Link to this post

    Hi Ross

    Sorry I should've explained better. I'd like the type-ahead functionality on the editor combo. I've so far implemented this as a custom editor template but cannot get the newly selected / typed value to be recognised by the DataFilter control.

    Thanks
    Keith
  5. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 13 Sep 2010 Link to this post

    Hi Keith Pilkington,

    You have to bind the combo to a special property on the ViewModel called Value.

    For example:

    <DataTemplate x:Key="NameFilterEditorTemplate">
                    <telerik:RadComboBox SelectedValue="{Binding Value, Mode=TwoWay, FallbackValue=null}"
                                         MinWidth="100"/>
    </DataTemplate>

    This online example does something similar. Look for the NameFilterEditorTemplate. It uses a combo instead of a TextBox.

    I hope this helps. Let me know if there are problems.

    Regards,
    Ross
    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
  6. Keith
    Keith avatar
    88 posts
    Member since:
    May 2007

    Posted 13 Sep 2010 Link to this post

    Hi Ross

    I'd used that example initially to create the templates and I can see that I need to bind to the Value property but the problem is that to make the type-ahead work the combo box needs to be bound to the database query rather than pre-populated with a list of values (as per the example) . I obviously can't get the datafilter to bind to two contexts so am a bit stuck in implementing the type-ahead combo functionality. I've  based the combo on Valeri's blog as found here: http://blogs.telerik.com/valerihristov/posts/08-12-04/auto-complete_combobox_with_wcf_service_and_radcontrols_for_silverlight.aspx

    Any help / ideas would be much appreciated.

    Thanks
    Keith
  7. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 13 Sep 2010 Link to this post

    Hello Keith Pilkington,

    You can try attaching to the EditorCreated event like demonstrated in the example. In the event handler, cast the editor to your type, i.e. RadComboBox and set anything as the ItemsSource. In other words -- you will have a reference to the combo-box so you can perform anything on it. This is demonstrated in the example. Please, examine it.

    I hope this helps.

    Greetings,
    Ross
    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
Back to Top
DevCraft banner