Canvas.Setleft sometimes not working in the same condition

Rancho 11 Reputation points
      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.



Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,694 questions
{count} votes