public override Size MeasureChildren(string layoutId,
MetaPanelBase metaPanel,
MetaElementStateDict stateDict,
ICollection elements,
Size availableSize)
{
Size retSize = new Size();
// Only apply if we match the incoming layout identifier
if (string.IsNullOrEmpty(Id) || Id.Equals(layoutId))
{
// If there are no column/row definitions then size to available area
if ((_columns.Count == 0) && (_rows.Count == 0))
{
foreach (UIElement element in elements)
{
stateDict[element].Element.Measure(availableSize);
retSize.Width = Math.Max(retSize.Width, stateDict[element].Element.DesiredSize.Width);
retSize.Height = Math.Max(retSize.Height, stateDict[element].Element.DesiredSize.Height);
}
}
else
{
BuildProxyColumns();
BuildProxyRows();
PreMeasure(availableSize);
MeasureElements(stateDict, elements);
UpdateDefinitions(stateDict, elements, false);
UpdateDefinitions(stateDict, elements, true);
CalculateOffsetsAndTotals();
retSize = CalculateDesiredSize(stateDict, elements, availableSize);
}
}
return retSize;
}