开发者

Move Canvas In Reverse Direction

开发者 https://www.devze.com 2023-01-11 21:48 出处:网络
I have two canvases. Currently, when I drag a rectangle inside of the first canvas, it also moves the rectangle in the second canvas.I do this using开发者_Go百科 TranslateTransform.

I have two canvases.

Currently, when I drag a rectangle inside of the first canvas, it also moves the rectangle in the second canvas. I do this using开发者_Go百科 TranslateTransform.

What I want to do is when I drag rectangle (A) to the left, rectangle (B) moves to the right, and vice versa etc.

Is there a relatively easy way to do this?

Chris


Would you be able to post some code as what you have already implemented if anything?

To do this I would simply apply an event to when the first rectangle moves (or is translated) to pass the transformation information to a method that translates the second rectangle with a negative value of x to make a "Reverse" transformation.


Easiest way would probably be to create a Converter which converts a value to its opposite (so positive to negative and vise versa). Apply it to the RenderTransform and bind it to the other Canvas TranslateTransform x/y values.


make it inside a double animation tag

 <DoubleAnimation AutoReverse="True" />
0

精彩评论

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