RadiantQ Forum
Product => WPF Gantt Package => Topic started by: michael.fried 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
-
Michael,
It is possible to set ViewStart on pager button click by using below code,
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
-
Hi Amar,
Many thanks for the quick solution! Works nicely.
Kind regards,
Michael