Пример #1
0
        /// <inheritdoc />
        protected override Size MeasureOverride(Size constraint)
        {
            double scale  = constraint.Width / this.ViewDuration.Ticks;
            double offset = this.ViewStartTime.Ticks;
            UIElementCollection children = this.InternalChildren;

            for (int i = 0; i < children.Count; i++)
            {
                UIElement child    = children[i];
                long      duration = TimelineCanvas.GetDuration(child).Ticks;
                long      start    = TimelineCanvas.GetStartTime(child).Ticks;
                double    width    = Math.Max(duration * scale, this.MinItemWidth);
                double    left     = (start - offset) * scale;
                child.Measure(new Size(width, constraint.Height));
            }

            return(constraint);
        }
Пример #2
0
        /// <inheritdoc />
        protected override Size ArrangeOverride(Size arrangeBounds)
        {
            double scale  = arrangeBounds.Width / this.ViewDuration.Ticks;
            double offset = this.ViewStartTime.Ticks;
            UIElementCollection children = this.InternalChildren;

            for (int i = 0; i < children.Count; i++)
            {
                UIElement child    = children[i];
                long      duration = TimelineCanvas.GetDuration(child).Ticks;
                long      start    = TimelineCanvas.GetStartTime(child).Ticks;
                double    width    = Math.Max(duration * scale, this.MinItemWidth);
                double    left     = (start - offset) * scale;
                child.Arrange(new Rect(left, 0, width, arrangeBounds.Height));
            }

            return(arrangeBounds);
        }