如何更改x:Bind的默认模式? [英] How to change default mode of x:Bind?
本文介绍了如何更改x:Bind的默认模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道他们为什么决定将Mode
的默认值设置为OneTime
,但这不是我大多数时候想要的.这浪费了我整天的调试时间.
I don't know why they decided to set default value for Mode
to OneTime
But that's not what I want most of the time. It wasted my whole day in debugging.
是否可以将x:Bind
的Mode
的OneWay
值设置为默认值?
Is there a way to set OneWay
value as default for Mode
of x:Bind
?
<!--This will not listen to future changes. it is OneTime by default-->
<TextBlock Text="{x:Bind Name}"/>
<!--We have to explicitly define Mode value-->
<TextBlock Text="{x:Bind Name, Mode=OneWay}"/>
推荐答案
从Windows 10版本1607(周年更新)开始,您可以设置SDK版本14393
starting in Windows 10, version 1607 (Anniversary Update), SDK version 14393 you can set
x:DefaultBindMode="OneWay"
在任何父xaml元素上,并且默认值将保留给该节点的未明确设置Mode
属性的子元素.
on any of the parent xaml elements and the default will persist for children of that node that haven't explicitly set the Mode
property.
这篇关于如何更改x:Bind的默认模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文