Given a System.Windows.Controls.Control, how can I find the top left and bottom right corners of the control, in pixels? Also, how can I then set the said corners? I want to be resizing or moving the control arbitrarily based on where it currently is. I’m in C#.
Thanks.
This depends on the container your control is in. I assume that you have the control in a Canvas, if you want to move it freely.
In this post you see how you get the position. With and Height you can get by the corresponding properties of the control.
In this post you see a snippet of code to move elements.
You can do this also with other containers than Canvas but this will be more tricky because you have to work with indirect values (margin).