New to Telerik UI for WPF? Download free 30-day trial

Add / Remove Items

Before proceding with adding/removing items, check Types of Items topic.

Add Items

In order to add new item to RadGanttView, first you have to create an instance of the class Telerik.Windows.Controls.GanttView.GanttTask, set its properties like Start, End, Title etc, and then add it to the TasksSource collection of the control.

var summaryTask = new GanttTask() 
 Start = new DateTime(2012,2,13), 
 End = new DateTime(2012,2,20), 
 Title = "Iteration 3", 
 Progress = 45 

In case you need to add a child to a summary task, you should add it to its Children collection:

var task1 = new GanttTask() 
 Start = new DateTime(2012,2,13), 
 End = new DateTime(2012, 2, 16), 
 Title = "testing" 
var task2 = new GanttTask() 
 Start = new DateTime(2012, 2, 16), 
 End = new DateTime(2012, 2, 20), 
 Title = "fixing" 

Remove Items

In order to remove a task you have to remove it from the TasksSource collection of the control or Children collection of a summary task:


Note that when removing a task, you should also remove programmatically the relations to this item.

See Also

In this article