October 23, 2020, 09:20:35 AM

See more Support incidents in our old archived forum.

Author Topic: Overlapping days when scrolling  (Read 2220 times)

michael.fried

  • Customers
  • Newbie
  • *
  • Posts: 23
Overlapping days when scrolling
« on: December 11, 2014, 07:56:58 AM »
Hi,

Is it possible to have overlap of some days when pressing TimeScaleShiftLeft/RightButton?

e.g. my current scroll view shows dates from 1.-10. Dec. is it possible to show the time span from 5.-15. Dec. when pressing the TimeScaleShiftRightButton instead of starting at 11. of Dec.?

Thanks and kind regards,
Michael

amarnath

  • RQ Members
  • Newbie
  • *
  • Posts: 33
Re: Overlapping days when scrolling
« Reply #1 on: December 11, 2014, 03:06:43 PM »
Michael,

It is possible to set ViewStart on pager button click by using below code,

Code: [Select]
        void ganttControl_TemplateApplied(object sender, EventArgs e)
        {
            this.ganttControl.GanttChart.Loaded += GanttChart_Loaded;
        }

        void GanttChart_Loaded(object sender, RoutedEventArgs e)
        {
            this.ganttControl.GanttChart.TimeScaleShiftRightButton.Click += TimeScaleShiftRightButton_Click;
            this.ganttControl.GanttChart.TimeScaleShiftLeftButton.Click += TimeScaleShiftLeftButton_Click;
        }

        void TimeScaleShiftLeftButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.ganttControl.GanttChart.ScrollViewerElement.HorizontalOffset != 0)
                return; // Do nothing until we reach left most scroll position.

            e.Handled = true; // To prevent default click processing in the gantt.

            // To shift by 5 days every time
            this.ganttControl.GanttChart.AnchorTime = this.ganttControl.GanttChart.AnchorTime - TimeSpan.FromDays(5);
        }

        void TimeScaleShiftRightButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.ganttControl.GanttChart.ScrollViewerElement.HorizontalOffset != this.ganttControl.GanttChart.ScrollViewerElement.ScrollableWidth)
                return; // Do nothign until we reach the right most scroll position.

            e.Handled = true; // To prevent default click processing in the gantt.

            // To shift by 5 days every time
            this.ganttControl.GanttChart.AnchorTime = this.ganttControl.GanttChart.AnchorTime + TimeSpan.FromDays(5);
        }

Thanks,
Amar

michael.fried

  • Customers
  • Newbie
  • *
  • Posts: 23
Re: Overlapping days when scrolling
« Reply #2 on: December 11, 2014, 05:08:28 PM »
Hi Amar,

Many thanks for the quick solution! Works nicely.

Kind regards,
Michael