OneTime 绑定有什么区别:
//Create the source string
string s = "Hello";
//Create the binding description
Binding b = new Binding("");
b.Mode = BindingMode.OneTime;
b.Source = s;
//Attach the binding to the target
MyText.SetBinding(TextBlock.TextProperty, b);
这个?
MyText.Text = s;
答案 0 :(得分:1)
它非常不同。通过第二种方法,您可以在代码中的任何时间点更改边界值。但是通过一次时间绑定,仅在应用程序启动或数据上下文更改时评估绑定值。 请参阅OneTime绑定说明here。