How Layout Process works in WPF?

Before you design the layout you need to understand what’s going behind the scenes when you create layouts in your applications. If you have knowledge about the layout process, you know what happens with your elements and you can build really great layouts.

The Layout process is two step process. It consists of the steps Measure andArrange . In the first step, the Measure step elements calculate their desired size.That means each element calculate their own size.To do this an element calls the Measure method in each direct child.After this , the DesiredSize property of the child is set. The parent element can access this DesiredSize and calculate it’s own desired size.The whole process walks down the element tree so it starts at the parent element,which calls measure on each direct child and each direct child again calls Measure on its direct children.
In the second step,the Arrange step,elements arrange their children. They do this by calling Arrange method on each direct child.The Arrange method takes a position and a final size.That means child knows the position for render and size as well.After the two process rendering occurs.