示例#1
0
        /// <summary>
        /// Arranges the size for the specified available <see cref="Size"/>.
        /// </summary>
        /// <param name="finalSize">
        /// The final <see cref="Size"/> of the  panel.
        /// </param>
        /// <returns>
        /// The arranged size for all child items.
        /// </returns>
        protected override Size ArrangeOverride(Size finalSize)
        {
            double strokeThickness = StrokeThickness.Abs();
            double margin          = strokeThickness / 2.0;

            boundRect = new Rect(
                margin,
                margin,
                Math.Max(0.0, finalSize.Width - strokeThickness),
                Math.Max(0.0, finalSize.Height - strokeThickness));

            center = new Point(boundRect.Width / 2, boundRect.Height / 2);

            geometry = null;
            return(finalSize);
        }
示例#2
0
        private Size GetNaturalSize()
        {
            double strokeThickness = StrokeThickness.Abs();

            return(new Size(strokeThickness, strokeThickness));
        }