如何在C#中访问Silverlight对象的附加属性?

时间:2022-04-06 21:33:08

Basically I'm trying to change the Canvas.Left property of an Ellipse Silverlight control in C#. Here is how I'm accessing the control:

基本上我正在尝试在C#中更改Ellipse Silverlight控件的Canvas.Left属性。这是我访问控件的方式:

Ellipse c1 = this.FindName("Circle1") as Ellipse;

How would I then set the Canvas.Left property?

然后我如何设置Canvas.Left属性?

Thanks,

Jeff

3 个解决方案

#1


4  

The answer lies in Silverlights use of Dependancy Properties

答案在于Silverlight使用Dependancy Properties

c1.SetValue(Canvas.LeftProperty, value);

#2


0  

something like this...

像这样的东西......

double left=50;
c1.SetValue(Canvas.LeftProperty, left);

#3


0  

Another way Canvas.SetLeft(c1,value)

另一种方式Canvas.SetLeft(c1,value)

#1


4  

The answer lies in Silverlights use of Dependancy Properties

答案在于Silverlight使用Dependancy Properties

c1.SetValue(Canvas.LeftProperty, value);

#2


0  

something like this...

像这样的东西......

double left=50;
c1.SetValue(Canvas.LeftProperty, left);

#3


0  

Another way Canvas.SetLeft(c1,value)

另一种方式Canvas.SetLeft(c1,value)