Reputation: 6091
<TextBox Text="{Binding MyTitle, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
Is there an equivalent to this when using x:Bind
?
If I use it like this, it only updates when focus is changed.
<TextBox Text="{x:Bind ViewModel.MyTitle, Mode=TwoWay}" />
Upvotes: 9
Views: 4703
Reputation: 408
For anyone reading this after 2017, UpdateSourceTrigger
has now been added and is described in the documentation. I believe it was added in Fall Creators Update (build 16299), so if your min version is 16299 or higher you will be able to use UpdateSourceTrigger
.
If you're targeting an older version of Windows you will have to keep using Binding
.
Upvotes: 8
Reputation: 1328
Ken Tucker is right, there is no UpdateSourceTrigger property for x:Bind and it behaves as it was set to PropertyChanged, except in case of TextBox when it triggers on lost focus. Check the bottom of this page. So you have to keep using Binding in this case.
Upvotes: 9