Say I have a Canvas
containing a child Rectangle
. The user then resizes the Rectangle by pulling the top left corner upwards and to the left (leaving the bottom right corner anchored).
The new position and size of the Rectangle is set like so (quasi code):
Canvas.SetLeft(rectangle, newLeft);
Canvas.SetTop(rectangle, newTop);
rectangle.Width += oldLeft - newLeft;
rectangle.Height += oldTop - newTop;
Will WPF perform a redraw for each of these changes in positioning/size (i.e. will each property change invalidate the elements involved and trigger a redraw by itself) or will they be "queued" ("marked as dirty") and performed all at once at some "next redraw" (whenever that may be)?
Edit: I am curious about to what degree (if any) setting Canvas.Left and Canvas.Top separately represents redundant / inefficient code, due to the multiple InvalidateArrange
calls done by Canvas
in such a scenario (compared to what, say, unified Canvas.SetTopLeft or Canvas.SetRect methods would). This partly due to warnings in the MSDN documentation that "Frequent calls to InvalidateArrange or in particular to UpdateLayout have significant performance consequences."