Appointment Filter doesn't work the second time around

7 posts, 0 answers
  1. Maaz
    Maaz avatar
    5 posts
    Member since:
    Apr 2013

    Posted 30 Apr 2013 Link to this post

    I'm facing this weird issue of the appoint filter not working the second time around.

    My Application has calendars for different users.

    When I first load the scheudle view (calendar) and try to filter it all works well. But then when I try to change the calendar for another user and then apply filter on it, nothing seems to happen. 

    When I debugged, I realised that the predicate does hit all the time the filter is supposed to be called. But the second time around the predicate doesn't call the filter appointment method at all. I'm puzzled as to why this happens and need you to help me. 

    As a background, I've bound the predicate (FilteredAppointments) to the appointment filter property in the xaml and the predicate then calls the filter appointment method (which returns a bool for each appointment). Also, all these are in separate classes, i.e. the predicate and the filterAppointments method.

    Please help, need to resolve this ASAP.
  2. Maaz
    Maaz avatar
    5 posts
    Member since:
    Apr 2013

    Posted 02 May 2013 Link to this post

    Any update on this? It's kind of really urgent for me to sort this out.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 02 May 2013 Link to this post

    Hi Maaz,

    In this example you can find how to dynamically change the filter. The example is for the RadScheduleView control for Silverlight, but the same code works fine for WPF as well.

    Hope this helps.

    Kind regards,
    Miroslav Nedyalkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. Maaz
    Maaz avatar
    5 posts
    Member since:
    Apr 2013

    Posted 03 May 2013 Link to this post

    I've tried exactly the same thing, it filters the first time ... but it doesn't the second time around. The predicate doesn't call the filter method at all (the second time around). What could be the reason?

    And could you also help me with the filter counts?
  6. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 06 May 2013 Link to this post

    Hi Maaz,

    Most probably the source of the problem is that you are not generating a new instance of the predicate, but you always return the same method. To make sure your predicate is correctly changed you need to change its value like this:
    Filter = new Func<IAppointment, bool>(a => this.MyFilter(a))
    instead of
    Filter = this.MyFilter;

    Hope this helps.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  7. Maaz
    Maaz avatar
    5 posts
    Member since:
    Apr 2013

    Posted 06 May 2013 Link to this post

    I tried this too, but again the same problem.

    When I first filter ... everything goes fine, I can filter as many times as I want to.

    But when I change the user to load another calendar, there's no filtering. The predicate is called, but the second time around the predicate fails to call it's method. I still don't know why. And now when I go back to the first user again, it still doesn't filter.
  8. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 09 May 2013 Link to this post

    Hi Maaz,

    I tried your scenario, but the filtering works as expected. Please take a look at the attached project and let me know if I'm missing something.

    Kind regards,
    Miroslav Nedyalkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
UI for WPF is Visual Studio 2017 Ready