コード例 #1
0
        private void UpdateFirstAndLast()
        {
            int count = base.InternalChildren.Count;
            int num   = base.InternalChildren.Count - 1;

            for (int i = 0; i < count; i++)
            {
                SingleRowTabPanel.SetIsFirst(base.InternalChildren[i], i == 0);
                SingleRowTabPanel.SetIsLast(base.InternalChildren[i], i == num);
            }
        }
コード例 #2
0
        protected override Size ArrangeOverride(Size finalSize)
        {
            double width = 0;

            foreach (UIElement internalChild in base.InternalChildren)
            {
                Size calculatedTabSize = SingleRowTabPanel.GetCalculatedTabSize(internalChild);
                internalChild.Arrange(new Rect(width, 0, calculatedTabSize.Width, calculatedTabSize.Height));
                width = width + calculatedTabSize.Width;
            }
            return(finalSize);
        }
コード例 #3
0
        protected override Size MeasureOverride(Size availableSize)
        {
            double num;
            double num1;

            this.UpdateFirstAndLast();
            double        num2  = 0;
            double        width = 0;
            List <double> nums  = new List <double>();

            foreach (UIElement internalChild in base.InternalChildren)
            {
                internalChild.Measure(availableSize);
                Size desiredSize = internalChild.DesiredSize;
                SingleRowTabPanel.SetCalculatedTabSize(internalChild, desiredSize);
                num2 = Math.Max(num2, desiredSize.Height);
                nums.Add(desiredSize.Width);
                width = width + desiredSize.Width;
            }
            num2 = Math.Min(availableSize.Height, num2);
            if (width <= availableSize.Width)
            {
                return(new Size(width, num2));
            }
            SingleRowTabPanel.CalculateTruncationThreshold(nums, width - availableSize.Width, out num, out num1);
            foreach (UIElement uIElement in base.InternalChildren)
            {
                Size   size         = uIElement.DesiredSize;
                double width1       = size.Width;
                double minimumWidth = SingleRowTabPanel.GetMinimumWidth(uIElement);
                if (width1 >= num)
                {
                    width1 = Math.Max(minimumWidth, num1);
                }
                Size size1 = new Size(width1, size.Height);
                SingleRowTabPanel.SetCalculatedTabSize(uIElement, size1);
                uIElement.Measure(size1);
            }
            return(new Size(availableSize.Width, num2));
        }