Exemple #1
0
        protected override Size MeasureOverride(Size availableSize)
        {
            Size b = base.MeasureOverride(availableSize);
            Size maxChildSize = new Size(0, 0);
            foreach (UIElement child in Children)
            {
                child.Measure(availableSize);
                maxChildSize.Width = Math.Max(maxChildSize.Width, child.DesiredSize.Width);
                maxChildSize.Height = Math.Max(maxChildSize.Height, child.DesiredSize.Height);
             }

            maxChildSize.Width = double.IsPositiveInfinity(availableSize.Width) ? maxChildSize.Width : availableSize.Width;

            maxChildSize.Height = double.IsPositiveInfinity(availableSize.Height) ? maxChildSize.Height : availableSize.Height;
            //reported size should be the largest child translated and rotaled to the maximum bounds...
            return maxChildSize.Double();
        }