xamluwpwindows-10xbind

How to change default mode of x:Bind?


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.

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}"/>

Solution

  • starting in Windows 10, version 1607 (Anniversary Update), SDK version 14393 you can set

    x:DefaultBindMode="OneWay"
    

    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.

    Here you can read more about it.