Exemple #1
0
        /// <exclude/>
        protected override Size MeasureOverride(Size availableSize)
        {
            Size infinitySize = new Size(double.PositiveInfinity, double.PositiveInfinity);

            foreach (UIElement uiElement in InternalChildren)
            {
                WindowControl window = uiElement as WindowControl;
                if (window == null)
                {
                    continue;
                }
                window.Measure(infinitySize);
            }

            return(new Size(double.IsPositiveInfinity(availableSize.Width) ? 0 : availableSize.Width,
                            double.IsPositiveInfinity(availableSize.Height) ? 0 : availableSize.Height));
        }
Exemple #2
0
        private Point GetWindowPosition(WindowControl window, Size availableSize)
        {
            double left = double.IsNaN(window.Left) ? window.ActualLeft : window.Left;
            double top  = double.IsNaN(window.Top) ? window.ActualTop : window.Top;

            Point defaultPosition = new Point();

            if (double.IsNaN(left) || double.IsNaN(top))
            {
                defaultPosition = GetDefaultLocation(availableSize, window);
            }

            if (double.IsNaN(left))
            {
                left = defaultPosition.X;
            }

            if (double.IsNaN(top))
            {
                top = window.Top = defaultPosition.Y;
            }

            return(new Point(left, top));
        }