Example #1
0
        public void Arrange(FlexSize availableSize, FlexSize offset)
        {
            double x     = 0;
            double width = availableSize.Lateral;

            if (Child is FrameworkElement frameworkChild)
            {
                switch (frameworkChild.HorizontalAlignment)
                {
                default:
                case HorizontalAlignment.Stretch:
                    width = availableSize.Lateral;
                    break;

                case HorizontalAlignment.Center:
                    x = (availableSize.Lateral - width) / 2;
                    break;

                case HorizontalAlignment.Left:
                    break;

                case HorizontalAlignment.Right:
                    x = availableSize.Lateral - width;
                    break;
                }
            }

            Child.Arrange(new Rect(new Point(x, offset.Longitudinal), new Size(width, availableSize.Longitudinal)));
        }
        public void Arrange(FlexSize availableSize, FlexSize offset)
        {
            double y      = 0;
            double height = availableSize.Lateral;

            if (Child is FrameworkElement frameworkChild)
            {
                switch (frameworkChild.VerticalAlignment)
                {
                default:
                case VerticalAlignment.Stretch:
                    height = availableSize.Lateral;
                    break;

                case VerticalAlignment.Center:
                    y = (availableSize.Lateral - height) / 2;
                    break;

                case VerticalAlignment.Top:
                    break;

                case VerticalAlignment.Bottom:
                    y = availableSize.Lateral - height;
                    break;
                }
            }

            Child.Arrange(new Rect(new Point(offset.Longitudinal, y), new Size(availableSize.Longitudinal, height)));
        }
Example #3
0
        public void Measure(FlexSize availableSize)
        {
            var size = new Size(availableSize.Lateral, availableSize.Longitudinal);

            Child.Measure(size);
        }