Avalonia
Avalonia copied to clipboard
RefreshContainer - support pull to refresh on desktop too
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"
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:
It would look this way and I think this could be interesting to users:
Describe alternatives you've considered
No response
Additional context
No response
I agree it would be great to make this work the same on desktop. However,
- WinUI does NOT support pull to refresh on desktop. Avalonia followed upstream WinUI here.
- Pointer presses are handled differently. This may be difficult to do.
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.
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.
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
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.
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?
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.