Controls are laying out in the WPF as a Tree strcture (VisualTree). 'Panel' is a type of control which can hold many child UIElements in it or in other words Panels are used as the LayoutSystem in WPF/Silverlight. Framework given panels are StackPanel,Grid,Canvas etc. And if you derive a class from Panel and override MeasureOverride() and ArrangeOverride() You will be able to make custom panels.
Ok now the answer to the question. In a custom panel or control you can call child.Measure(availableSize) to let the all the next level children to know that 'available'size is what 'child' has got now. And giving an opportunity to decide those child elements to fit in it. It is like I tell my children that this is the space we got decide your sizes. So once a control calls Measure() it passes that to the subsequent children and each of them will call its own measure() till the end of the VisualTree and once that call finishes you will be able to see the desired size child wanted in child.DesiredSize. Now that you got all children's desiredSizes you can compute the desiredsize for the control and return that at the end of the MeasureOverride() function
The Layout mechanism works in a two pass, Measure and Arrange. Once you measure your children with the availablesize you can arrange your children because at that momement you will know what size each of the children need from the child.DesiredSize