4

Could someone please advise me on the "correct" way of implementing Pull to refresh on UWP?


Below are some examples I've found however I'm not sure which one is using the best approach:

Any advice is much appreciated

Xylynx
  • 267
  • 1
  • 3
  • 11

2 Answers2

3

There is no standard answer for this question, basically, there are two points we need to implement:

  1. Get the offset changes when user pull something on the control

  2. Generate some indicator to notify user


Both XamlPullToRefresh and PullToRefreshUWP_WindowsComposition use the new Windows Composition API: Windows.UI.Composition namespace

Ref Windows.UI.Composition Overview

The API is a powerful supplement to existing frameworks such as XAML to give developers of UWP applications a familiar C# surface to add to their application. These APIs can also be used to create DX style framework-less applications.

Please notice that this API works only on Windows 10.


While AmazingPullToRefresh uses Manipulation API and implement all things by calculating offset changes. A similar implementation can be found here


If you want to implement a cool pull-to-refresh control, I would recommend using the Windows.UI.Composition API. You can get start from here

Franklin Chen - MSFT
  • 4,845
  • 2
  • 17
  • 28
1

The functionality of pulling to refresh is not used by microsoft.

Reloading a page / data is something we have still in our mind from thinking apps like a website.

Why not have a synced database and alway update your UI with the data which got changed in your local db? For eg. see firebase.google.com

If you want to implement this feature anyway there is not really a way to go. I have used the PullToRefresh.UWP library from NuGet. For a tutorial see: codeproject.com

With some tweaking it works but sometimes when I lift my finger of the screen after pulling down the bar won't go up again.

So the answer is: Sorry, but nobody can give you an answer on how to do this the "correct" way. But is there a correct way anywhere? Like almost always in programming. It depends on the case you will use it. Hope this will help you.

TableCreek
  • 799
  • 8
  • 18