MvvmCross handles updates when using One-Time binding by transferring data from the ViewModel to the View only once, when the binding source is initially set. After this initial transfer, the binding does not actively monitor change messages or events from the ViewModel. Therefore, any subsequent changes to the ViewModel's property will not be reflected in the View unless the binding source itself is reset or reinitialized.
Key Points of One-Time Binding in MvvmCross:
1. Initial Data Transfer: The binding transfers data from the ViewModel to the View when the binding is first established. This is typically useful for fields that are configurable but do not change frequently after they have been set.
2. No Continuous Monitoring: Unlike Two-Way or One-Way bindings, One-Time bindings do not continuously monitor the ViewModel for changes. This means that if the ViewModel's property changes after the initial binding, the View will not be updated automatically.
3. Use Cases: One-Time binding is commonly used in scenarios where the data is static or rarely changes, such as setting static text from language files. Once a language is selected, it is uncommon for the user to change it frequently, making One-Time binding suitable for such cases[1].
4. Resetting the Binding Source: If the binding source is reset or reinitialized, the One-Time binding will transfer the new data from the ViewModel to the View again. However, this requires explicit action to reset the binding source.
5. Limitations in Dynamic Views: In dynamic views, such as those using `MvxRecyclerView`, One-Time bindings may not behave as expected if the views are recycled. In such cases, the binding may be re-evaluated as views are reused, which can lead to unexpected behavior[6].
In summary, MvvmCross's One-Time binding is designed for scenarios where data is set once and does not need to be updated dynamically. It simplifies the binding infrastructure by avoiding continuous monitoring of the ViewModel for changes, but it requires manual intervention to update the View if the ViewModel's data changes after the initial binding.
Citations:[1] https://www.mvvmcross.com/documentation/fundamentals/data-binding
[2] https://www.mvvmcross.com/documentation/fundamentals/dependency-injection
[3] https://learn.microsoft.com/en-us/dotnet/maui/xaml/fundamentals/mvvm?view=net-maui-9.0
[4] https://stackoverflow.com/questions/46558177/mvvmcross-updates-to-bound-property-in-view-not-propagating-to-property-in-viewm
[5] https://blog.ostebaronen.dk/2018/01/mvvmcross-binding-target.html
[6] https://stackoverflow.com/questions/48910503/binding-mode-onetime-in-mvxrecyclerview
[7] https://github.com/MvvmCross/MvvmCross/issues/87
[8] https://learn.microsoft.com/en-us/archive/msdn-magazine/2014/march/async-programming-patterns-for-asynchronous-mvvm-applications-data-binding
[9] https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/data-binding/binding-mode?view=net-maui-9.0
[10] https://www.reddit.com/r/dotnetMAUI/comments/103ai8p/mvvm_problems_having_troubles_with_data_bindings/
[11] https://www.mvvmcross.com/documentation/advanced/customizing-using-App-and-Setup