How can I mark a `DependencyProperty` as `BindsTwoWayByDefault` in UWP?
In WPF you could mark a DependencyProperty
on a custom control as binding Mode=TwoWay
by default using FrameworkPropertyMetadataOptions.BindsTwoWayByDefault
, but FrameworkPropertyMetadata
seems to be missing in UWP. The UWP documentation on the {Binding}
markup extension says that the default mode may change, but gives no indication on how to affect it.
Mode
Specifies the binding mode, as one of these values: "OneTime", "OneWay", or "TwoWay". These correspond to the constant names of the BindingMode enumeration. The default depends on the binding target but in most cases it is "OneWay". Note that this differs from the default for {x:Bind}, which is "OneTime".
How can you change the default binding mode for a UWP XAML Dependency Property on a custom control?
The current UWP SDK doesn't have any support for affecting the default BindingMode
for a DependencyProperty
; that is only possible within WPF.
On UWP all {Binding}
have BindingMode.OneWay
as default, while {x:Bind}
has BindingMode.OneTime