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

Remove duplicate members from SimpleFilterMemberComboBox

3 Answers 23 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Vikas
Top achievements
Rank 1
Vikas asked on 20 Apr 2016, 12:52 PM

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.

3 Answers, 1 is accepted

Sort by
0
Vikas
Top achievements
Rank 1
answered on 20 Apr 2016, 05:12 PM

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

<telerik:RadComboBox
                                Name="PART_SimpleFilterMemberComboBox"
                                Margin="0,0,3,0"
                                MinWidth="100"
                                VerticalAlignment="Center"
                                ItemsSource="{Binding SimpleFilter.AvailableMembers}"
                                SelectedItem="{Binding SimpleFilter.SelectedMember, Mode=TwoWay}">
                            <i:Interaction.Behaviors>
                                <local:DataFilterBehavior/>
                            </i:Interaction.Behaviors>
                        </telerik:RadComboBox>

 

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);
            }

0
Maya
Telerik team
answered on 25 Apr 2016, 10:35 AM
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.

Regards,
Maya
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Vikas
Top achievements
Rank 1
answered on 25 Apr 2016, 01:06 PM

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

Tags
DataFilter
Asked by
Vikas
Top achievements
Rank 1
Answers by
Vikas
Top achievements
Rank 1
Maya
Telerik team
Share this question
or