Пример #1
0
        protected override Size ArrangeOverride(Size finalSize)
        {
            double unitsPerSecond = this.UnitsPerSecond;
            double indent         = this.Indent;

            foreach (UIElement uiElement in this.InternalChildren)
            {
                double d = TimePanel.GetTime((DependencyObject)uiElement);
                if (double.IsNaN(d))
                {
                    d = 0.0;
                }
                double x           = unitsPerSecond * d + indent;
                Size   desiredSize = uiElement.DesiredSize;
                double duration    = TimePanel.GetDuration((DependencyObject)uiElement);
                if (!double.IsNaN(duration))
                {
                    desiredSize.Width = !double.IsInfinity(duration) ? duration * unitsPerSecond : finalSize.Width;
                }
                uiElement.Arrange(new Rect(new Point(x, 0.0), desiredSize));
            }
            return(finalSize);
        }
Пример #2
0
        protected override Size MeasureOverride(Size availableSize)
        {
            double unitsPerSecond = this.UnitsPerSecond;
            Size   availableSize1 = new Size(double.PositiveInfinity, double.PositiveInfinity);

            foreach (UIElement uiElement in this.InternalChildren)
            {
                if (uiElement != null)
                {
                    double duration = TimePanel.GetDuration((DependencyObject)uiElement);
                    if (!double.IsNaN(duration))
                    {
                        availableSize1.Width = duration * unitsPerSecond;
                        uiElement.Measure(availableSize1);
                        availableSize1.Width = double.PositiveInfinity;
                    }
                    else
                    {
                        uiElement.Measure(availableSize1);
                    }
                }
            }
            return(new Size());
        }