Generic pull to refresh

EmmanuelIstaceEmmanuelIstace USMember ✭✭
edited June 2017 in Xamarin.Forms

Hi,

I have a bunch of views using misc. controls, tableview for instance.

Is there a way to easily integrate pull-to-refresh on those tableview ?

I tried to put the table view within a list view, but the rendering of the table view is not ok.

Any ideas ? I searched on google but can't find pull-to-refresh outside the listview :(

Answers

  • ChaseFlorellChaseFlorell CAInsider, University mod

    How are you using a TableView? What is the content and what are you refreshing? It might sound like an odd question, but it'll help us come to a solution.

  • EmmanuelIstaceEmmanuelIstace USMember ✭✭
    edited June 2017

    An example, I use a table view to display a kind of profile of the user (contact infos and misc informations and profile related configuration)

    I actually have a refresh button on the bottom on the screen but it would be nice to use the native gesture of the system.

    I also use third party datagrid in my applications with pull-to-refresh so I'm sure our users will want to pull to refresh and not pay attention to the bottom button.

    I join a screenshot of one of the table view to give you a bit of help.

    When I press the refresh button I call the "Refresh" method of my repository in my ViewModel and then update my ViewModel data with the latest data from the repository.

  • EnisNecipogluEnisNecipoglu USMember ✭✭

    You can use listview's header only for refreshable content.

    Like that:

    <ListView IsPullToRefreshEnabled="True" >
    <ListView.Header>
    
    YOUR CONTENT GOES HERE
    </ListViewHeader>
    </ListView>
    

    You can refresh like listview but there is no DataTEmplate in listview. I think you wanted that.

    * Header should be one Layout. For example only a StackLayout or Grid or any view. Like ContentPage.Content

  • ChasakisDChasakisD USMember ✭✭
    edited November 2017
    Look at this repo of the PullToRefresh Layout Plugin. Just add the TableView inside this one. https://github.com/jamesmontemagno/Xamarin.Forms-PullToRefreshLayout
  • XavierHdzXavierHdz Member

    Works for me!!!

Sign In or Register to comment.