RefreshView.IsRefreshing doesn't work with OneWay bindings
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 290
Description
### 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](https://learn.microsoft.com/en-us/archive/msdn-magazine/2014/march/async-programming-patterns-for-asynchronous-mvvm-applications-data-binding) which are applied to [Commanding](https://learn.microsoft.com/en-us/archive/msdn-magazine/2014/april/async-programming-patterns-for-asynchronous-mvvm-applications-commands). 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_
Contributor guide
Research direction
Start with the RefreshView control code and the public IRefreshView and BindableObject.SetValueCore APIs described in the issue. Run the linked NetMauiIssue12469 reproduction, compare the OneWay and TwoWay binding cases, and verify that completing the refresh clears IsRefreshing without replacing the OneWay binding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100