Remove duplicate members from SimpleFilterMemberComboBox

4 posts, 0 answers
  1. Vikas
    Vikas avatar
    37 posts
    Member since:
    Dec 2015

    Posted 20 Apr 2016 Link to this post

    I am trying to find a solution to display only unique members in the rad data filter. For ex I have a class Employee with 3 properties Name, Age, Address. User clicks on the + sign and in the first filter editor selects Name. Then user adds another filter editor, in this one i do not want to display Name property similarly if user selects age in the second one, I want to remove age option from the first filter and not have that in other editors.

    I am reading some posts about SimpleFilterMemberComboBox and how to manipulate the available members items, but that looks very compilcated, Just wondering if there is some easy option for this.

  2. Vikas
    Vikas avatar
    37 posts
    Member since:
    Dec 2015

    Posted 20 Apr 2016 in reply to Vikas Link to this post

    I am able to get to the list of members, but it appears the Available members is not a observable collection hence i can not modify it.

    I have created a behavior and attached it to the combobox

                                    ItemsSource="{Binding SimpleFilter.AvailableMembers}"
                                    SelectedItem="{Binding SimpleFilter.SelectedMember, Mode=TwoWay}">


    and in the behavior i am listening for combobox intialized or loaded event and then trying to update available members

    if ((sender as RadComboBox).Items.Count > 0)
                    (((sender as RadComboBox).TemplatedParent as Telerik.Windows.Controls.Data.DataFilter.FilterControl).
                    DataContext as Telerik.Windows.Controls.Data.DataFilter.FilterViewModel).SimpleFilter.AvailableMembers.ToList().RemoveAt(0);

  3. Maya
    Maya avatar
    4062 posts

    Posted 25 Apr 2016 Link to this post

    Hi Vikas,

    Did you manage to get the behavior you want? Do you customize the template of the filter and attach the behavior to the combo box or you tried another approach? 
    Generally, available members are based on the properties of the corresponding item and it supports filtering on multiple criteria on a single property rather than just applying a single filter for each property.

    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  4. Vikas
    Vikas avatar
    37 posts
    Member since:
    Dec 2015

    Posted 25 Apr 2016 in reply to Maya Link to this post

    Yes i got it working by applying the behavior to the combo box in the filter template.

Back to Top