使用 x:Bind 时,UpdateSourceTrigger=PropertyChanged 的​​等效项是什么?

What is the equivalent to UpdateSourceTrigger=PropertyChanged when using x:Bind?

<TextBox Text="{Binding MyTitle, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>

使用 x:Bind 时是否有与此等效的内容?

如果我这样使用它,它只会在焦点改变时更新。

<TextBox Text="{x:Bind ViewModel.MyTitle, Mode=TwoWay}" />

Ken Tucker 是对的,x:Bind 没有 UpdateSourceTrigger 属性,它的行为与设置为 PropertyChanged 时一样,但 TextBox 在失去焦点时触发时除外。检查 this 页面的底部。 所以在这种情况下你必须继续使用Binding。

对于 2017 年之后阅读本文的任何人,现已添加 UpdateSourceTrigger 并在 the documentation 中进行了描述。我相信它是在 Fall Creators Update(内部版本 16299)中添加的,因此如果您的最低版本是 16299 或更高版本,您将能够使用 UpdateSourceTrigger.

如果您的目标是 Windows 的旧版本,则必须继续使用 Binding