问题
In my WPF application I have a control that acts like a zoom box. You can zoom and drag its content. In my case this content is a grid that contains an image and some UserControls. These UserControls have to be positioned ontop of the image to highlight some segments of that image.
Here is an example (this is not an actual use case):
My question is, how should I position those red rectangles (what is the better practise here)?
- By replacing the grid with a canvas and use
Canvas.SetLeft
resp.Canvas.SetTop
?
or
- By manipulating the RenderTransform of those rectangles?
Note: The rectangles are interactive (they have to interact with the mouse and maybe some other input devices).
来源:https://stackoverflow.com/questions/45208505/is-it-good-practice-to-position-uielements-via-rendertransform