[英]How do you access an attached property of a Silverlight object in C#?
Basically I'm trying to change the Canvas.Left
property of an Ellipse Silverlight control in C#. 基本上我正在尝试在C#中更改Ellipse Silverlight控件的
Canvas.Left
属性。 Here is how I'm accessing the control: 这是我访问控件的方式:
Ellipse c1 = this.FindName("Circle1") as Ellipse;
How would I then set the Canvas.Left
property? 然后我如何设置
Canvas.Left
属性?
Thanks, 谢谢,
Jeff 杰夫
The answer lies in Silverlights use of Dependancy Properties 答案在于Silverlight使用Dependancy Properties
c1.SetValue(Canvas.LeftProperty, value); c1.SetValue(Canvas.LeftProperty,value);
something like this... 像这样的东西......
double left=50;
c1.SetValue(Canvas.LeftProperty, left);
另一种方式Canvas.SetLeft(c1,value)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.