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

How can I filter Jumplist at runtime?

1 Answer 25 Views
JumpList
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michael
Top achievements
Rank 1
Michael asked on 03 Oct 2014, 07:20 AM
Hi

When I add following code in constructor the filter works fine.

GenericFilterDescriptor<ProposedAppointmentClient> filter = new GenericFilterDescriptor<ProposedAppointmentClient>(
    (pac) =>
    {
        return pac.Worker.Name.Contains("Wa");
    }
);
FilterDescriptors.Add(filter);

Now I want change filter at runtime. For test purposes I implement following command:

private RelayCommand _setSevdailFilterCommand;
 
/// <summary>
/// Gets the SetSevdailFilterCommand.
/// </summary>
public RelayCommand SetSevdailFilterCommand
{
    get
    {
        return _setSevdailFilterCommand ?? (_setSevdailFilterCommand = new RelayCommand(
            () =>
            {
                FilterDescriptors = null;
 
                GenericFilterDescriptor<ProposedAppointmentClient> filter = new GenericFilterDescriptor<ProposedAppointmentClient>(
                    (pac) =>
                    {
                        return pac.Worker.Name.Contains("Se");
                    }
                );
                FilterDescriptors = new List<GenericFilterDescriptor<ProposedAppointmentClient>>();
                FilterDescriptors.Add(filter);
            },
            () => true));
    }
}

Now all items are visible. Why? 

1 Answer, 1 is accepted

Sort by
0
Accepted
Ves
Telerik team
answered on 08 Oct 2014, 06:51 AM
Hi Michael,

Please, find attached a small example, showing this scenario. Basically, the implementation differs from yours in using an ObservableCollection and not replacing it, but clearing it before adding the new filter descriptors.

Best regards,
Ves
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
JumpList
Asked by
Michael
Top achievements
Rank 1
Answers by
Ves
Telerik team
Share this question
or