RadiantQ WPF Gantt
TimeSpan Paging
Previous Topic  Next Topic 

Accessing the Pager Buttons


There are buttons at the bottom right and bottom left to page the view right and left respectively. You can access them and disable them for example as follows:


        public MainPage()

        {

            InitializeComponent();


            this.ganttControl.TemplateApplied += new EventHandler(ganttControl_TemplateApplied);

        }


        void ganttControl_TemplateApplied(object sender, EventArgs e)

        {

            this.ganttControl.GanttChart.Loaded += new RoutedEventHandler(GanttChart_Loaded);

        }


        void GanttChart_Loaded(object sender, RoutedEventArgs e)

        {

            this.ganttControl.GanttChart.TimeScaleShiftLeftButton.IsEnabled = false;

        }


Also note that the shift left and right buttons can be hidden as mentioned in the previous page.


Customize Paging


Sometimes you will want to "page" by a custom span, rather than the default paging behavior. You can do so, by listening to the above pager button clicks and page by your preferred time span.


In the example below, we page by 5 days, instead of the default paging behavior.


        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 nothing until we reach 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);

        }



� RadiantQ 2009 - 2019. All Rights Reserved.