Exemplo n.º 1
0
        public double MoveEvent(
            object eo,
            double top,
            double left,
            double width,
            bool enew    = true,
            bool animate = false
            )
        {
            FrameworkElement     el;
            TimelineDisplayEvent de;
            double currentLeft;

            el = eo as FrameworkElement;
            Debug.Assert(el != null);

            de = el.DataContext as TimelineDisplayEvent;

            if (left > -el.ActualWidth + 1 && left < m_canvas.ActualWidth + el.ActualWidth - 1)
            {
                if (m_parent.IsMainBand)
                {
                    m_parent.TimelineTray.FireOnEventVisible(el, (el.DataContext as TimelineDisplayEvent));
                }
            }

            SetTopWithScrollOffset(el, top, true, animate);

            currentLeft = (double)el.GetValue(Canvas.LeftProperty);

            if (m_eventStoryboard != null &&
                animate &&
                currentLeft != left &&
                Math.Abs(currentLeft - left) < el.ActualWidth)
            {
                el.SetValue(Canvas.LeftProperty, left);

                m_eventStoryboard.AddDouble(ANIMATION_DURATION,
                                            el,
                                            new PropertyPath(Canvas.LeftProperty),
                                            currentLeft,
                                            left);
            }
            else
            {
                el.SetValue(Canvas.LeftProperty, left);
            }

            return(de.TopWithoutOffset + de.DescriptionHeight);
        }
Exemplo n.º 2
0
        private FrameworkElement PositionColumn(
            FrameworkElement el,
            double left,
            double top,
            double width,
            double height,
            int index      = 0,
            string content = null,
            Storyboard sb  = null
            )
        {
            double currLeft;

            Debug.Assert(top > -1);

            if (content != null && ((string)el.DataContext) != content)
            {
                el.DataContext = content;
            }

            el.SetValue(Canvas.TopProperty, 0.0);
            el.SetValue(Canvas.ZIndexProperty, index);
            el.Height = height;

            currLeft = (double)el.GetValue(Canvas.LeftProperty);

            if (sb != null &&
                Math.Abs(left - currLeft) < width * 1.5)
            {
                sb.AddDouble(ANIMATION_DURATION, el, new PropertyPath(Canvas.LeftProperty), currLeft, left)
                .AddDouble(ANIMATION_DURATION, el, new PropertyPath(FrameworkElement.WidthProperty), el.Width, width);
            }
            else
            {
                el.SetValue(Canvas.LeftProperty, left);
                el.Width = width;
            }

            return(el);
        }
Exemplo n.º 3
0
        private FrameworkElement PositionColumnMarker(
            FrameworkElement el,
            double left,
            double width,
            double height,
            int index      = 0,
            string content = null,
            Storyboard sb  = null
            )
        {
            double currentLeft;

            if (el != null)
            {
                if (content != null && ((string)el.DataContext) != content)
                {
                    el.DataContext = content;
                }

                el.SetValue(Canvas.TopProperty, height - Math.Max(el.ActualHeight, el.Height));
                el.SetValue(Canvas.ZIndexProperty, MAX_EVENT_ZINDEX + index);
                el.Width = width;

                currentLeft = (double)el.GetValue(Canvas.LeftProperty);

                if (sb != null &&
                    Math.Abs(left - currentLeft) < width * 1.5)
                {
                    sb.AddDouble(ANIMATION_DURATION, el, new PropertyPath(Canvas.LeftProperty), currentLeft, left)
                    .AddDouble(ANIMATION_DURATION, el, new PropertyPath(FrameworkElement.WidthProperty), el.Width, width);
                }
                else
                {
                    el.Width = width;
                    el.SetValue(Canvas.LeftProperty, left);
                }
            }
            return(el);
        }