在Silverlight应用程序中调用SetBinding()两次?

在Silverlight应用程序中调用SetBinding()两次?,silverlight,binding,Silverlight,Binding,我有一个Silverlight 4应用程序,并通过编程在对象上设置了一些绑定,例如: Binding bBorder = new Binding(); bBorder.Source = CellItem; bBorder.Mode = BindingMode.OneWay; bBorder.Path = new PropertyPath("Border"); appointmentItem.SetBinding(Ap

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

        Binding bBorder = new Binding();
        bBorder.Source = CellItem;
        bBorder.Mode = BindingMode.OneWay;
        bBorder.Path = new PropertyPath("Border");
        appointmentItem.SetBinding(AppointmentItem.BorderBrushProperty, bBorder);
不管任何最佳实践课程如何,如果这段代码运行两次,我最终会得到一个已注册两次的绑定,还是第一个绑定被正确删除

谢谢,
Tim

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

谢谢Dmitry,我在internet上的任何地方都找不到它。即使在codebhind中,您是如何设置这些绑定的?您还应该能够直接在XAML中设置这些绑定。