locked
Start PullToRefresh Programatically with refreshing animation RRS feed

  • Question

  • User182189 posted

    Hi,

    I'm trying to add the pull-to-refresh functionality to a ListView. It's working great (I only tested it on Android though), but I want the refresh command and the refresh animation to start when the view is shown.

    My ListView: listView = new ListView { RowHeight = 70, ItemTemplate = new DataTemplate(typeof(NodeItemCell)), RefreshCommand = new Command(() => { ReadNodes(); }), IsRefreshing = true, IsPullToRefreshEnabled = true, }; I'm doing this on the OnAppearing() method:

    protected override void OnAppearing () { //.... Device.BeginInvokeOnMainThread(() => { listView.IsRefreshing = true; listView.BeginRefresh(); }); //.... }

    The command is executed as it should be but the refreshing icon doesn't appear.

    I know this can be done in java, because I have a similar app made in java and it's working like I intended by doing this: // java code: protected void onCreate(Bundle savedInstanceState) { //... swipeContainer = (SwipeRefreshLayout) findViewById(R.id.swipeContainer); swipeContainer.post(new Runnable() { @Override public void run() { swipeContainer.setRefreshing(true); } }); //...

    So the question is if this can be achieved in Xamarin.Forms or if I'm misusing the library.

    Thanks in advance!

    Wednesday, January 13, 2016 3:25 PM

All replies

  • User194001 posted

    No answer but this same problem is discussed here.

    Wednesday, February 17, 2016 5:57 PM
  • User243695 posted

    Manuel Perez, have you accomplished this?

    Tuesday, September 6, 2016 4:09 PM
  • User268714 posted

    I've just used the listView.BeginRefresh(); and it worked as expected, showing the loader.

    protected override void OnAppearing () { //.... Device.BeginInvokeOnMainThread(() => { //listView.IsRefreshing = true; listView.BeginRefresh(); }); //.... }

    Tuesday, October 25, 2016 1:05 PM