【问题标题】:Calling SetBinding() twice in Silverlight application?在 Silverlight 应用程序中调用 SetBinding() 两次?
【发布时间】:2012-12-10 11:48:38
【问题描述】:

我有一个 Silverlight 4 应用程序并以编程方式在对象上设置了一些绑定,例如:

        Binding bBorder = new Binding();
        bBorder.Source = CellItem;
        bBorder.Mode = BindingMode.OneWay;
        bBorder.Path = new PropertyPath("Border");
        appointmentItem.SetBinding(AppointmentItem.BorderBrushProperty, bBorder);

不管有什么最佳实践课程,如果这段代码运行两次,我最终会得到一个已注册两次的绑定,还是第一个绑定被正确删除?

谢谢, 蒂姆

【问题讨论】:

  • 您在代码隐藏中设置了哪些绑定?您还应该能够直接在 XAML 中设置这些绑定。

标签: silverlight binding


【解决方案1】:

第一个绑定将被删除,并且只会注册一个绑定。

【讨论】:

  • 谢谢 Dmitry,我在互联网上的任何地方都找不到这个。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-03-13
  • 2010-12-29
  • 2014-10-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多