dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.21k stars 1.75k forks source link

RefreshView.IsRefreshing doesn't work with OneWay bindings #12469

Open bakerhillpins opened 1 year ago

bakerhillpins commented 1 year ago

Description

The only way you can get RefreshView.IsRefreshing to work in a binding scenario is to use a TwoWay binding. Therefore one can't create a UX where the Swipe feature executes the command and the feedback from the completion of the command clears the bit false. Simple one way round tripping the process. The design forces one to have a Read/Write property to interface with RefreshView.IsRefreshing. This is unfortunate as it doesn't work with Async MVVM programming paradigms which are applied to Commanding. These designs/patterns are built around completion notification via read only properties.

The reason this happens is because the RefreshView control code manipulates the RefreshView.IsRefreshing property as an external user would, through it's Getter/Setter. This updates the BindableProperty using BindableObject.SetValue which results in clearing OneWay bindings when a Manual Set occurs. Thus the UX fails. The Control code should really be using the public method BindableObject.SetValueCore where it can set the value but not cancel the OneWay Binding. This would require the control code to use an internal interface exposing access to SetValueCore within the handler code rather than the public IRefreshView which only exposes the Public property.

Steps to Reproduce

Clone example repo. Select Issue 12469 Pull down and note the Busy Indicator never completes. Switch to the TwoWay code and note it does complete.

Link to public reproduction project repository

https://github.com/bakerhillpins/Issues/tree/NetMauiIssue12469

Version with bug

6.0 Release Candidate 2 or older

Last version that worked well

6.0 Release Candidate 2 or older

Affected platforms

iOS, Android, Windows, macOS, I was not able test on other platforms

Affected platform versions

All

Did you find any workaround?

Workaround

Create a TwoWay binding and let the binding engine constantly complain about not being able to bind to the Property Setter. Write some extra code to wrap the Read Only property so that it looks like a Read Write property.

Relevant log output

No response

ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

homeyf commented 1 year ago

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 2.0. Can repro on Android and iOS platform with sample project. https://github.com/bakerhillpins/Issues/tree/NetMauiIssue12469 Windows: image Android: image

jared-morley commented 1 year ago

I've applied the fix described and confirmed it works