/// <summary>Measures the child elements of a <see cref="T:System.Windows.Controls.Border" /> before they are arranged during the <see cref="M:System.Windows.Controls.Border.ArrangeOverride(System.Windows.Size)" /> pass.</summary>
        /// <param name="constraint">An upper <see cref="T:System.Windows.Size" /> limit that cannot be exceeded.</param>
        /// <returns>The <see cref="T:System.Windows.Size" /> that represents the upper size limit of the element.</returns>
        // Token: 0x06004264 RID: 16996 RVA: 0x0012F824 File Offset: 0x0012DA24
        protected override Size MeasureOverride(Size constraint)
        {
            UIElement child           = this.Child;
            Size      result          = default(Size);
            Thickness borderThickness = this.BorderThickness;

            if (base.UseLayoutRounding && !FrameworkAppContextSwitches.DoNotApplyLayoutRoundingToMarginsAndBorderThickness)
            {
                DpiScale dpi = base.GetDpi();
                borderThickness = new Thickness(UIElement.RoundLayoutValue(borderThickness.Left, dpi.DpiScaleX), UIElement.RoundLayoutValue(borderThickness.Top, dpi.DpiScaleY), UIElement.RoundLayoutValue(borderThickness.Right, dpi.DpiScaleX), UIElement.RoundLayoutValue(borderThickness.Bottom, dpi.DpiScaleY));
            }
            Size size  = Border.HelperCollapseThickness(borderThickness);
            Size size2 = Border.HelperCollapseThickness(this.Padding);

            if (child != null)
            {
                Size size3         = new Size(size.Width + size2.Width, size.Height + size2.Height);
                Size availableSize = new Size(Math.Max(0.0, constraint.Width - size3.Width), Math.Max(0.0, constraint.Height - size3.Height));
                child.Measure(availableSize);
                Size desiredSize = child.DesiredSize;
                result.Width  = desiredSize.Width + size3.Width;
                result.Height = desiredSize.Height + size3.Height;
            }
            else
            {
                result = new Size(size.Width + size2.Width, size.Height + size2.Height);
            }
            return(result);
        }