Ejemplo n.º 1
0
        /// <summary>
        /// 更新最大时间线长度
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TaskBar_OnTimeLineWidthChanged(object sender, RoutedEventArgs e)
        {
            TaskBar taskBar = sender as TaskBar;

            if (TimeLineWidth < taskBar.TimeLineWidth)
            {
                TimeLineWidth = taskBar.TimeLineWidth;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 拖拽TaskBar与滚动条联动
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TaskBar_OnMoveThumebChanged(object sender, RoutedEventArgs e)
        {
            TaskBar taskBar       = e.OriginalSource as TaskBar;
            double  offSet        = taskBar.EndTime * taskBar.BaseWidth;
            double  leftOffSet    = taskBar.StartTime * taskBar.BaseWidth;
            double  currentOffset = TimeLineScrollViewer.HorizontalOffset + ticksGrid.ActualWidth;

            if (offSet >= TimeLineScrollViewer.HorizontalOffset + ticksGrid.ActualWidth)
            {
                TimeLineScrollViewer.ScrollToHorizontalOffset(TimeLineScrollViewer.HorizontalOffset + taskBar.BaseWidth);
                ScaleBarScrollViewer.ScrollToHorizontalOffset(TimeLineScrollViewer.HorizontalOffset + taskBar.BaseWidth);
            }
            else if (leftOffSet <= TimeLineScrollViewer.HorizontalOffset)
            {
                TimeLineScrollViewer.ScrollToHorizontalOffset(TimeLineScrollViewer.HorizontalOffset - taskBar.BaseWidth);
                ScaleBarScrollViewer.ScrollToHorizontalOffset(TimeLineScrollViewer.HorizontalOffset - taskBar.BaseWidth);
            }
        }