public override Size MeasureChildren(string layoutId,
MetaPanelBase metaPanel,
MetaElementStateDict stateDict,
ICollection elements,
Size availableSize)
{
// Measure each element in turn
_count = 0;
Size maxSize = new Size();
foreach (UIElement element in elements)
if (element != null)
{
element.Measure(Utility.SizeInfinity);
// We ignore items being removed
if (stateDict[element].Status != MetaElementStatus.Removing)
{
// We ignore items that are collapsed
if (element.Visibility != Visibility.Collapsed)
{
// Find the widest and tallest element
maxSize.Width = Math.Max(maxSize.Width, element.DesiredSize.Width);
maxSize.Height = Math.Max(maxSize.Height, element.DesiredSize.Height);
// Count number of valid elements
_count++;
}
}
}
// Max length is the diagonal length of biggest element
_maxLength = Math.Sqrt((maxSize.Width * maxSize.Width) + (maxSize.Height * maxSize.Height));
// Always use the provided size
return availableSize;
}