uwp Binding modes and defaults


Example

There are three modes of XAML bindings exists for either Binding and x:Bind:

  • OneTime: Update happens only once, on initialization of the view during InitializeComponent() call. (ViewModel[sends data when initializing] -> View)
  • OneWay: View is updated when ViewModel changes. But not in the reverse direction. (ViewModel -> View)
  • TwoWay: View is updated when ViewModel changes and vice versa. (ViewModel <-> View)

Default mode of Binding is OneWay and that of x:Bind is OneTime.

Select the modes like this:

<TextBlock Text="{Binding SomeText, Mode=TwoWay}" /> <!-- Binding -->
<TextBlock Text="{x:Bind SomeText, Mode=OneWay}" /> <!-- x:Bind -->