Chart Time Span Changing
The Chart's time span could change due to a variety of reasons - the end-user zooming, paging, AnchorTime change, etc. A reliable way to listen to all these changes is like this:
void Gantt_Loaded(object sender, RoutedEventArgs e)
{
// Raised when the user zooms the view.
this.Gantt.Zoomed += new ZoomedEventHandler(Gantt_Zoomed);
// Setup a dependency property in your MainPage called AnchorTime which will change when the chart's anchor time changes.
Binding binding = new Binding("AnchorTime");
binding.Source = this.Gantt.GanttChart;
this.SetBinding(AnchorTimeProperty, binding);
}
Before Zooming
There is also an event that gets raised before the chart zooms the time-line to a specific zoom level, because of the end-user zooming via mouse. You can choose to "cancel" such zooms by listening to this event:
this.fxgantt.BeforeZooming += new EventHandler<RadiantQ.Windows.Controls.Gantt.BeforeZoomEventArgs>(fxgantt_BeforeZooming);
void fxgantt_BeforeZooming(object sender, RadiantQ.Windows.Controls.Gantt.BeforeZoomEventArgs e)
{
// Note that the same can be achieved by setting the BaseTimeUnitWidthMinimum property. But, this gives flexibility to control the zoom level based on context.
if (e.NewBaseTimeUnitWidth < 20)
e.Cancel = true;
}
� RadiantQ 2009 - 2019. All Rights Reserved.