Пример #1
0
        protected override Size MeasureOverride(Size availableSize)
        {
            Size adjustedSize = new Size(availableSize.Width - 15, availableSize.Height);
            Size cardSize = adjustedSize.GoldenSize(4, Orientation.Horizontal);

            foreach (UIElement child in InternalChildren)
                child.Measure(cardSize);

            return new Size((cardSize.Width * 4) + 15, cardSize.Height);
        }
Пример #2
0
        protected override Size ArrangeOverride(Size finalSize)
        {
            Size adjustedSize = new Size(finalSize.Width - 15, finalSize.Height);
            Size cardSize = adjustedSize.GoldenSize(4, Orientation.Horizontal);

            foreach (UIElement child in InternalChildren.OfType<PilePlaceHolder>())
            {
                child.Arrange(new Rect(new Point(0, 0), cardSize));
            }

            double x = cardSize.Width + 15;
            foreach (UIElement child in InternalChildren.OfType<UIElement>().Where(c => !(c is PilePlaceHolder)))
            {
                child.Arrange(new Rect(x, 0, cardSize.Width, cardSize.Height));
                x += cardSize.Width;
            }

            return new Size((cardSize.Width * 4) + 15, cardSize.Height);
        }