How can I filter Jumplist at runtime?

2 posts, 1 answers
  1. Michael
    Michael avatar
    12 posts
    Member since:
    Oct 2012

    Posted 03 Oct 2014 Link to this post

    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? 
  2. Answer
    Ves
    Admin
    Ves avatar
    2879 posts

    Posted 08 Oct 2014 Link to this post

    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.

     
  3. DevCraft banner
Back to Top