RadiantQ Forum
Product => Silverlight Gantt Package => Topic started by: mkk on August 11, 2014, 02:33:10 PM
-
Hi
In my application I have two ComboBoxes, which are being used to set the start and end times for the GanttChart. For this purpose I use some modified code from your sample, which works as expected.
Now I want these ComboBoxes to be automatically set to the LeftMostVisibleTime and the RightMostVisibleTime of the GanttChart (I use FitToPage as standard) when the end user changes anything (zoom in/out scroll etc.) on the GanttGrid and the GanttChart.
When the ComboBoxes are changed automatically it most not trigger a restart of the first process (similar to when the user changes the ComboBoxes)
Could you advice how I can handle this (various Events and properties)?
Thanks!
-
Mark,
You can listen to GanttChart.ViewTimeRangeChanged or GanttChart.ViewportTimeRangeChanged (has to be used if you have horizontal scrolling turned on in the chart - ResizeToFit = false).
When you set your DateTime editor's values, you should turn on a bool flag in your page so that you can distinguish user-edited VS programatically edited scenarios in the rest of your page.
Thanks
Support
-
I would also like to know which time properties I should use to get the right start end time of the Gantt Chart when ResizeToFit is set to true and to false.
Thanks!
Michael
-
Mark,
You can use the VisualStartTime and VisualEndTime properties of GanttChart. Here is the sample code,
void ganttControl_TemplateApplied(object sender, EventArgs e)
{
this.ganttControl.GanttChart.AnchorTime = this.ganttControl.ProjectStartDate;
this.ganttControl.GanttChart.ViewportTimeRangeChanged += GanttChart_ViewportTimeRangeChanged;
}
void GanttChart_ViewportTimeRangeChanged(object sender, EventArgs e)
{
DateTime visualStart = this.ganttControl.GanttChart.VisualStartTime;
DateTime visualEnd = this.ganttControl.GanttChart.VisualEndTime;
}