Uno: x:DefaultBindMode="OneWay" is not supported on all platforms

Created on 25 Feb 2020  路  6Comments  路  Source: unoplatform/uno

Current behavior

x:DefaultBindMode="OneWay" has no effect for iOS/Android while it works perfectly for UWP [and WASM (as a bug at the moment)].
ios DefaultBindMode issue

Expected behavior

x:DefaultBindMode="OneWay" should work
UWP normal behavior for DefaultBindMode

How to reproduce it (as minimally and precisely as possible)

Repro:
https://github.com/zipswich/AppDebugUno

Environment

Nuget Package:
Uno.UI

Package Version(s):
2.1.0-dev.1338

Affected platform(s):

  • [x] iOS
  • [x] Android
  • [x] WebAssembly (working as a bug at the moment)
  • [ ] WebAssembly renderers for Xamarin.Forms
  • [ ] macOS
  • [ ] Windows
  • [ ] Build tasks
  • [ ] Solution Templates

Visual Studio:

  • [ ] 2017 (version: )
  • [x] 2019 (version: )
  • [ ] for Mac (version: )

Relevant plugins:

  • [ ] Resharper (version: )

Anything else we need to know?

kinenhancement

Most helpful comment

@zipswich OneWay is more expensive than OneTime for sure, even in Uno. OneWay and TwoWay need to hook to INotifyPropertyChanged and DependencyProperty changes.

All 6 comments

In fact this is not yet implemented on any platform, in case of WASM it seems to be a bug instead, that x:Binds now behave as TwoWay, even when they are not

in case of WASM it seems to be a bug instead, that x:Binds now behave as TwoWay

That is a surprise. I need to keep this in mind. Microsoft's choice of 'OneTime" as the default is irrational unless the initialization of "OneWay" binding is significantly more expensive.

I updated the content of this issue to reflect the latest info, thanks so much @MartinZikmund & @zipswich :) !
Other related PR for x:Bind (https://github.com/unoplatform/uno/pull/2702)

@zipswich OneWay is more expensive than OneTime for sure, even in Uno. OneWay and TwoWay need to hook to INotifyPropertyChanged and DependencyProperty changes.

Is the hooking process quite expensive or the actual calling of handlers of INotifyPropertyChanged expensive. My original understanding was the latter. The handlers are never called (at least for my apps) for those bindings that need only one-time binding because their values are not changed. If it is the former, then I can understand the rationale.

@zipswich hooking can be expensive, as it needs to be done on all levels. It's not particularly expensive per binding, but if there are many, it can add up :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MartinZikmund picture MartinZikmund  路  3Comments

Ali-YousefiTelori picture Ali-YousefiTelori  路  4Comments

jeromelaban picture jeromelaban  路  3Comments

MartinZikmund picture MartinZikmund  路  3Comments

JanabiSoft picture JanabiSoft  路  3Comments