We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

InbuiltTaskCollection empty even though items have been added and are visible

I've combined the first two Gantt examples (Essential Gantt and Project Scheduler) so that I can populate items from a view model, and also add/insert/delete items.

The ViewModel.GetTaskDetails() method is called from the view model and items are added as expected (image View.png).

However, when it comes to using the InsertTask command, the GanttControl.Model.InbuiltTaskCollection is empty (image Code.png)!

I have attached two images to show the data displayed, and then the empty InbuiltTaskCollection after the AddTaskCommand is clicked.

Why is the collection empty? Should I be using a different collection to add the new item to because i am populating from the view model, rather than from Xml?

I cannot find any information on InbuiltTaskCollection anywhere!

Many thanks,

Attachment: InbuiltTaskCollection_3fb6bfc3.rar

4 Replies

JR James Randle October 2, 2015 01:19 PM UTC

Hello Again!
I produced a minimal project to demonstrate the situation.

If you set a break point after the line "int count = gantt.Model.InbuiltTaskCollection.Count;" then run the project and right click the gantt > Add > Task, you will see the collection is empty when the breakpoint is hit.

Thanks again,

Attachment: CS_90fa7b63.rar

RA Rachel A Syncfusion Team October 5, 2015 12:41 PM UTC

Hi James,


Thanks for contacting Syncfusion support.


We can add, remove and insert the items from the item source collection of the Gantt Control as in the below code example



                (gantt.ItemsSource as ObservableCollection<TaskDetails>).Add(new TaskDetails


                    StartDate = (gantt.ItemsSource as ObservableCollection<TaskDetails>)[count-1].FinishDate,

                    Duration = new TimeSpan(2, 0, 0, 0)


 Also, we have modified the sample for your reference. You can download the sample from the following location.


Sample: gantt


Note: InbuildTaskCollection property is provided to access the task items when item source is imported from the xml which makes it easier to access the task items.


Rachel. A

JR James Randle October 28, 2015 01:41 PM UTC

Hi Rachel,
Sorry for the slow reply!

That did the trick ... thanks for your help :0)


RA Rachel A Syncfusion Team October 29, 2015 03:38 AM UTC

Hi James,

Thanks for the update.

Please let us know if you have any query.

Rachel. A

Live Chat Icon For mobile
Up arrow icon