2010-10-05 134 views
0

有人可以帮我找出为什么l.X1被设置为默认值(0.0),当绑定的源有一个值为156.以下图像可能是自我解释。Silverlight属性绑定

alt text

+0

是否一切都在同一个线程上声明和运行?我的猜测可能不是,这就是为什么你看到这种行为。我们需要更多代码来帮助 - 抱歉。 – 2010-10-05 13:09:06

+0

一切都是在同一个线程中声明的。 – async 2010-10-05 13:10:36

+0

如果我在MyObj类中的以下行注释出来,一切都按预期工作。但我需要此属性作为依赖项属性。 public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register(“CenterX”,typeof(double),typeof(MyObj),null); public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register(“CenterY”,typeof(double),typeof(MyObj),null); – async 2010-10-05 13:19:25

回答

0

CLR集合方法中的这些缺失行导致了奇怪的结果。在设置的方法中,我使用了不同的附加属性。 SetValue(CenterXProperty,value); SetValue(CenterYProperty,value);

+0

将此答案标记为已接受 – Ozan 2010-10-06 06:07:36

0

http://forums.silverlight.net/forums/t/66005.aspx

我不认为你可以使用一个DependencyProperty在Silverlight中的BindingSource。请参阅上面的链接。

+0

只是好奇,为什么Framworkelement暴露了一个名为SetBinding(dp,binding)。当它不受支持的方法 – async 2010-10-05 13:50:59

+0

我的理解是WPF确实支持SetBinding()到Binding.Source中的DependencyProperty对象,但是Silverlight不支持。不过,我不会发誓。你可以用WPF模拟一个测试吗? – Les 2010-10-05 23:46:35

+0

CLR集合方法中的这些缺失行导致了奇怪的结果。在设置的方法中,我使用了不同的附加属性。 SetValue(CenterXProperty,value); SetValue(CenterYProperty,value); – async 2010-10-06 05:28:00