Avalonia icon indicating copy to clipboard operation
Avalonia copied to clipboard

RefreshContainer - support pull to refresh on desktop too

Open gentledepp opened this issue 9 months ago • 7 comments

Is your feature request related to a problem? Please describe.

Our users expect the same behavior to be available across all platforms. So even on desktops, they are used to "pull down a list to refresh it"

truncation

Describe the solution you'd like

Add some property to the refreshcontainer that allows us to enabpe Pull2Refresh on desktop systems too.

If enabled for desktop, we'd only have to remove the hardcoded conditional in PullGestureRecognizer: image

It would look this way and I think this could be interesting to users:

truncation

Describe alternatives you've considered

No response

Additional context

No response

gentledepp avatar Apr 26 '24 12:04 gentledepp

I agree it would be great to make this work the same on desktop. However,

  1. WinUI does NOT support pull to refresh on desktop. Avalonia followed upstream WinUI here.
  2. Pointer presses are handled differently. This may be difficult to do.

robloo avatar Apr 26 '24 23:04 robloo

Thanks for responding! I was also a contributor on Xamarin.Forms back in the days and never got a response anywhere near as fast - if ever!

Regarding 1: Well, maybe we can let the developer decide if he wants to opt in this feature. May be feasible to disable it by default... I don't know.

Regarding 2: Isn't avalonia following WPF "design"? In WPF, there were "PreviewEvents" that you could hook into. That way, the refreshcontainer would not interfere with the "PointerPressed" event logic of the ListBox item.

gentledepp avatar Apr 29 '24 05:04 gentledepp

In WPF, there were "PreviewEvents" that you could hook into. That way, the refreshcontainer would not interfere with the "PointerPressed" event logic of the ListBox item.

We rarely need preview events. Most of the time (not always) tunnelling events is enough.

timunie avatar Apr 29 '24 06:04 timunie

I see. But, coming from WPF, [the docs on tunneling events)[https://docs.avaloniaui.net/docs/get-started/wpf/tunnelling-events] do not make things clear to me. I'm sorry.

Can I simply change the PullGestureRecognizer to subscribe to (what is it subscribed to anyways - the parent control of the scrollviewer?) "the thing" using a tunneling approach instead of ho it does it's thing currently?

It would really be great to have the PullGestureRecognizer handle this event before any other part of the UI

gentledepp avatar Apr 29 '24 07:04 gentledepp

Actions that would fall under gestures aren't intuitive when using the mouse, especially when the user expects a refresh button or hotkey. The user wouldn't know that the gesture is available with the mouse pointer, even if it's implemented.

emmauss avatar Apr 29 '24 08:04 emmauss

Well... I disaggree - some "not so native" users think that anything that works on a tablet, also works on desktop. They simply cannot differentiate - at least that is our experience.

But I understand your concern. Could we at least make this "overridable" in the PullGestureRecognizer, so we can cleanly override this behavior?

gentledepp avatar Apr 29 '24 09:04 gentledepp

The user isn't able to provide their own pull gesture recognizer since the code that handles gestures in PullRefresh is internal. Solving this https://github.com/AvaloniaUI/Avalonia/issues/13645 should make it possible to use touch gestures with mouse.

emmauss avatar Apr 30 '24 11:04 emmauss