Пример #1
0
        /// <exclude/>
        protected override Size MeasureOverride(Size availableSize)
        {
            UIElement licenseErrorElement = null;

            CheckLicense(ref licenseErrorElement);
            if (licenseErrorElement != null)
            {
                licenseErrorElement.Measure(availableSize);
                return(licenseErrorElement.DesiredSize);
            }

            if (Child1 != null)
            {
                Child1.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                _child1AutoSize = Child1.DesiredSize;
            }
            if (Child2 != null)
            {
                Child2.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                _child2AutoSize = Child2.DesiredSize;
            }

            Rect child1Rect, splitterRect, child2Rect;
            Size desiredSize = GetRects(availableSize, out child1Rect, out splitterRect, out child2Rect);

            if (Child1 != null)
            {
                Child1.Measure(child1Rect.Size);
            }
            if (SplitterPresenter != null)
            {
                SplitterPresenter.Measure(splitterRect.Size);
            }
            if (Child2 != null)
            {
                Child2.Measure(child2Rect.Size);
            }

            return(desiredSize);
        }