Self-reference data

Is it possible to use self referenced data in the WPF Gantt similar to this? https://ej2.syncfusion.com/aspnetcore/documentation/gantt/data-binding/#self-referential-data-binding-flat-data

I have an existing database with a table of Tasks containing (among many other properties)  TaskID and ParentID (which the TaskID of the parent task).  

Thanks

4 Replies 1 reply marked as answer

RU Russ March 7, 2021 09:21 AM UTC

I've worked around this by creating a hierarchical observable collection of tasks and nested child tasks so hardly a massive issue but would still like to know if I'm missing something that could let me avoid that step.

Thanks


SS Sridevi Sivakumar Syncfusion Team March 8, 2021 12:40 PM UTC

Hi Russ,

Greetings from Syncfusion.

Query:  Is it possible to use self referenced data in the WPF Gantt ?

We have analysed your requirement and we don't have the support to achieve your requirement.

If you need to define the parent-child relationship between tasks, you will add the child task to the parent task as per the below code snippet.

[ViewModel.cs]:
 
public ObservableCollection<Task> GetData() 
        { 
            var data = new ObservableCollection<Task>(); 
             data.Add(new Task() { Id = 1, Name = "Scope", StDate = new DateTime(2011, 7, 8), EndDate = new DateTime(2011, 7, 24), Complete = 40d }); 
            data[0].ChildTask.Add((new Task() { Id = 2, Name = "Determine project office scope", StDate = new DateTime(2011, 7, 15), EndDate = new DateTime(2011, 7, 17), Complete = 20d, })); 
            data[0].ChildTask.Add((new Task() { Id = 3, Name = "Justify Project Offfice via business model", StDate = new DateTime(2011, 7, 19), EndDate = new DateTime(2011, 7, 21), Complete = 20d })); 
            data[0].ChildTask.Add((new Task() { Id = 4, Name = "Secure executive sponsorship", StDate = new DateTime(2011, 7, 21), EndDate = new DateTime(2011, 7, 24), Complete = 10d, })); 
            data[0].ChildTask.Add((new Task() { Id = 5, Name = "Secure complete", StDate = new DateTime(2011, 7, 24), EndDate = new DateTime(2011, 7, 24), Complete = 10d })); 
... 
 
           return data; 
        } 

Screenshot:

 
 

Please have a sample from the below link 
https://www.syncfusion.com/downloads/support/forum/163260/ze/GanttSample993164056

For more information about binding the data to the Gantt control
https://help.syncfusion.com/wpf/gantt/getting-started?cs-save-lang=1&cs-lang=xaml#binding-data-to-ganttcontrol

Let us know if you need any further assistance.

Regards,
Sridevi S. 
  
 


Marked as answer

RU Russ March 14, 2021 07:14 AM UTC

Great thanks for confirming that


SS Sridevi Sivakumar Syncfusion Team March 15, 2021 06:22 AM UTC

Hi Russ,

Thank you for the update.

Please let us know if you need any further assistance.

Regards,
Sridevi S.


Loader.
Up arrow icon