开发者

Use XAML data binding to bind each end of a Line to the center of two shapes on a Canvas

开发者 https://www.devze.com 2022-12-24 18:58 出处:网络
I have 开发者_高级运维a Canvas in Silverlight with two ellipses on it.The ellipses are animated via events in the code behind.I have added a line two the canvas and I would like each end of the line t

I have 开发者_高级运维a Canvas in Silverlight with two ellipses on it. The ellipses are animated via events in the code behind. I have added a line two the canvas and I would like each end of the line to be bound to the center of each ellipse. Is it possible to do this in XAML databinding or will I have to manually move the end of the line around in code?


While I haven't tried it, you may be able to achieve something using an ElementName Binding to bind between the Canvas.Top (and Left) properties of the ellipse and the line. You'll probably need a converter to offset that to center of the ellipse.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号