Rancho-2111 avatar image
0 Votes"
Rancho-2111 asked AlexLi-MSFT commented

Canvas.Setleft sometimes not working in the same condition

       I want to achieve the effect of moving the rectangle edge (one rectangle moves along one side of another rectangle) using Canvas.SetLeft to set the left border of the moving rectangle. **Under the same conditions**, it can be achieved, but sometimes it has The border of the moving rectangle is set to a certain value, **but the graphical interface is not displayed as such** (it will cross the border of a rectangle).
     ` ` Then I tried to set it using element.Margin, but Margin is based on a certain element The borders are set as the starting point.I want to use the upper left corner of Canvas as a reference to set the Margin properties of these rectangles.What should I do?(The above is machine translation content

Looking forward to your reply.



· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Welcome to our Microsoft Q&A platform!

Is your PickedElement inside a Canvas? If not, Canvas.Setleft will not work.

0 Votes 0 ·

Thanks for your reply
It's inside the canvas.My problem is that Canvas.SetLeft (element, value) can change the Left value of the element, but it is not shown in the interface.I don't understand why this is the case.

0 Votes 0 ·

Please provide more code and screenshot

0 Votes 0 ·

0 Answers