示例#1
0
        protected override void ArrangeChild(UIElement child, Rect rect, Size finalSize)
        {
            Shape shape = child as Shape;

            if (shape != null && shape.Stretch == Stretch.Fill)
            {
                Size   desiredSize = XYAxisBasePanel.GetDesiredSize(child);
                double num         = Math.Round((this.Orientation == Orientation.Horizontal ? rect.X : rect.Y) + this.ElementWidth(desiredSize) / 2.0);
                rect = this.Orientation != Orientation.Horizontal ? new Rect(0.0, num, finalSize.Width, rect.Height) : new Rect(num, 0.0, rect.Width, finalSize.Height);
            }
            base.ArrangeChild(child, rect, finalSize);
        }
示例#2
0
        protected override double ElementOffset(UIElement element)
        {
            Size   desiredSize = XYAxisBasePanel.GetDesiredSize(element);
            double num         = 0.0;

            switch (XYAxisElementsPanel.GetPosition(element))
            {
            case AxisElementPosition.Inside:
            case AxisElementPosition.None:
                num = this.ElementHeight(desiredSize);
                break;

            case AxisElementPosition.Cross:
                num = this.ElementHeight(desiredSize) / 2.0;
                break;
            }
            return(-num);
        }
示例#3
0
 protected override Size ArrangeOverride(Size finalSize)
 {
     foreach (UIElement uiElement in this.Children)
     {
         Size   desiredSize = XYAxisBasePanel.GetDesiredSize(uiElement);
         double num1        = this.Presenter.ConvertScaleToAxisUnits(this.GetCenterCoordinate(uiElement), this.ElementWidth(finalSize)) - this.ElementWidth(desiredSize) / 2.0;
         double num2        = this.ElementOffset(uiElement);
         double num3        = this.ElementWidth(desiredSize);
         double num4        = this.ElementHeight(desiredSize);
         if (this.IsInverted)
         {
             num2 = this.ElementHeight(finalSize) - (num2 + num4);
         }
         if (this.Orientation == Orientation.Horizontal)
         {
             this.ArrangeChild(uiElement, new Rect(num1, num2, num3, num4), finalSize);
         }
         else
         {
             this.ArrangeChild(uiElement, new Rect(num2, num1, num4, num3), finalSize);
         }
     }
     return(finalSize);
 }
示例#4
0
        protected override Size MeasureOverride(Size availableSize)
        {
            this.Populate(this.ElementWidth(availableSize));
            double val2 = 0.0;

            if (this.Children.Count > 0)
            {
                Size availableSize1 = new Size(double.PositiveInfinity, double.PositiveInfinity);
                foreach (UIElement uiElement in this.Children)
                {
                    uiElement.Measure(availableSize1);
                }
                val2 = EnumerableFunctions.MaxOrNullable <double>(Enumerable.Select <UIElement, double>(Enumerable.Cast <UIElement>((IEnumerable)this.Children), (Func <UIElement, double>)(child => this.ElementHeight(XYAxisBasePanel.GetDesiredSize(child)) + this.ElementOffset(child)))) ?? 0.0;
            }
            if (this.Orientation == Orientation.Horizontal)
            {
                return(new Size(0.0, Math.Max(0.0, val2)));
            }
            return(new Size(Math.Max(0.0, val2), 0.0));
        }