Beispiel #1
0
        protected override void ArrangeOverride()
        {
            base.ArrangeOverride();
            ColumnDefinitions.SetAvailableSize(ActualWidth);
            RowDefinitions.SetAvailableSize(ActualHeight);

            foreach (FrameworkElement child in GetVisibleChildren())
            {
                int col = GetColumn(child);
                int row = GetRow(child);
                if (col >= ColumnDefinitions.Count)
                {
                    col = ColumnDefinitions.Count - 1;
                }
                if (col < 0)
                {
                    col = 0;
                }
                if (row >= RowDefinitions.Count)
                {
                    row = RowDefinitions.Count - 1;
                }
                if (row < 0)
                {
                    row = 0;
                }

                PointF position = new PointF(
                    (float)ColumnDefinitions.GetOffset(col) + _innerRect.Location.X,
                    (float)RowDefinitions.GetOffset(row) + _innerRect.Location.Y);

                SizeF childSize = new SizeF(
                    (float)ColumnDefinitions.GetLength(col, GetColumnSpan(child)),
                    (float)RowDefinitions.GetLength(row, GetRowSpan(child)));

                ArrangeChild(child, child.HorizontalAlignment, child.VerticalAlignment, ref position, ref childSize);
                child.Arrange(SharpDXExtensions.CreateRectangleF(position, childSize));
            }
        }