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.
Unfortunately, activation email could not send to your email. Please try again.

InbuiltTaskCollection empty even though items have been added and are visible

Thread ID:

Created:

Updated:

Platform:

Replies:

120677 Oct 2,2015 08:26 AM Oct 28,2015 11:38 PM WPF 4
loading
Tags: GanttControl
James Randle
Asked On October 2, 2015 08:26 AM

Hi,
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,
James.

Attachment: InbuiltTaskCollection_3fb6bfc3.rar

James Randle
Replied On October 2, 2015 09:19 AM

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,
James.

Attachment: CS_90fa7b63.rar

Rachel A [Syncfusion]
Replied On October 5, 2015 08:41 AM

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

 

[C#]

                (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.

 

Regards,
Rachel. A


James Randle
Replied On October 28, 2015 09:41 AM

Hi Rachel,
Sorry for the slow reply!

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

James.

Rachel A [Syncfusion]
Replied On October 28, 2015 11:38 PM

Hi James,

Thanks for the update.

Please let us know if you have any query.

Regards,
Rachel. A

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;