RadiantQ WPF Gantt
Task Time Change Events
Previous Topic  Next Topic 

Listening to Task Time Changes


As the end user drags or resizes the task bar in the gantt chart, the TaskTimeChanging event is fired which gives you an option to adjust the time (to round it to a certain date or time, for example) based on your application logic.


Here is some example code:


// In MainPage constructor

this.fxgantt.TaskTimeChanging += new EventHandler<TimesChangingEventArgs>(FlexyGantt_TaskTimeChanging);



void FlexyGantt_TaskTimeChanging(object sender, TimesChangingEventArgs args)

{

     args.StartTime = Utils.GetSelfOrNextMonday(args.StartTime);// A utility method defined by you that does some rounding.

     args.EndTime = Utils.GetSelfOrNextMonday(args.EndTime);

}


Listening to Task Time Changed


When the end user is done dragging or resizing a task bar to change it's times the TaskTimeChanged event is fired after updating the times in the bound data. The arguments provide a reference to the data object where the times were changed.


// In MainPage constructor

this.fxgantt.TaskTimeChanged += new EventHandler<TimesChangeEventArgs>(fxgantt_TaskTimeChanged);


void fxgantt_TaskTimeChanging(object sender, TimesChangingEventArgs e)

{

    Task boundTask = e.DataSource as Task;

    System.Diagnostics.Debug.WriteLine(string.Format("Task Time is Changing to Start: {0}, End: {1}", e.StartTime.ToString(), e.EndTime.ToString()));

}



� RadiantQ 2009 - 2019. All Rights Reserved.