Pull to refresh in viewmodel

2 posts, 0 answers
  1. Gagan
    Gagan avatar
    6 posts
    Member since:
    Nov 2015

    Posted 08 Jun 2016 Link to this post

    Is there a way i can make PullToRefresh a command in my viewmodel?

    Or is there another way to make it more MVVM?

  2. Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1237 posts

    Posted 09 Jun 2016 Link to this post


    I already answered this question in your support ticket. However I will copy/paste the same answer here so that others from the community can benefit from it.

    Pull to refresh is a feature allowing end customers to manually update a list of items. This is an UI operation and it should not be triggered from code. If developers need to update that same list they should directly add items to the list's ItemsSource. 

    As for the other way, you can create a custom behavior which can be attached to the RadListView. That behavior can listen for the RefreshRequested event and can trigger your custom command as well as the EndRefresh() method. Using behavior does not break any MVVM approach and is frequently used.

    If you ask if there is out of the box approach for implementing pull to refresh command - the answer is no. Currently we do not support such command. However, there are many third party behaviors (e.g. event to command behavior) that can fit your scenario. You can try looking for them as well.

    Pavel R. Pavlov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top