protected override Size MeasureOverride(Size constraint)
        {
            Size size = base.MeasureOverride(constraint);

            if (constraint.Width > 0)
            {
                double totalWidth = this.Items.Count * 180;
                double finalWidth = 180;

                if (totalWidth > (constraint.Width - 170))
                {
                    finalWidth = (constraint.Width - 170) / this.Items.Count;
                }

                foreach (TabView item in this.Items)
                {
                    WebTabItem container = (WebTabItem)this.ItemContainerGenerator.ContainerFromItem(item);

                    if ((container != null) && (container.ActualWidth > 0))
                    {
                        container.Width = finalWidth;
                    }
                }
            }

            return(size);
        }
Beispiel #2
0
        protected override Size MeasureOverride(Size constraint)
        {
            Size size = base.MeasureOverride(constraint);

            if (constraint.Width > 0)
            {
                double totalWidth   = this.Items.Count * 180;
                double rightPadding = SystemParameters2.Current.IsGlassEnabled ? 170 : 70;
                double finalWidth   = 180;

                if (totalWidth > (constraint.Width - rightPadding))
                {
                    finalWidth = (constraint.Width - rightPadding) / this.Items.Count;
                }

                foreach (TabView item in this.Items)
                {
                    WebTabItem container = this.ItemContainerGenerator.ContainerFromItem(item) as WebTabItem;

                    if ((container != null) && (container.ActualWidth > 0))
                    {
                        container.Width = finalWidth;
                    }
                }
            }

            return(size);
        }