Handlng Children CollectionChanged

2 posts, 0 answers
  1. Kenny
    Kenny avatar
    16 posts
    Member since:
    Feb 2013

    Posted 04 Jun 2014 Link to this post

    Hi Telerik.

    I use my own MyGantTaskCollection as a custom collection class for storing MyGanttTask (also custom, based on GanttTask).
    MyGanttTask.Children is also a MyGanttTakCollection.

    I noticed that the GanttView always uses the base.Children collection for displaying children. That is why I set up a sync between both collections. Basically: this.Children.CollectionChanged += ....   // sync added and/or removed with base.Children.
    This solves the issue for my children to show up in the GanttChart.

    The problem I'm facing now is that when the user drags/drops in the gantt chart from/to a child collection, there is no way for me to monitor this changement and sync the changements made in base.children to this.children as base.children is not observable..

    Could you provide a solution for this? Ideally the solution would solve the first issue; the fact that GanttView does not accept a custom childcollection..
  2. Polya
    Admin
    Polya avatar
    200 posts

    Posted 05 Jun 2014 Link to this post

    Hi Kenny,

    What I understand is that the GanttTask Children collection is not suitable for your scenario and so a new Children collection of type MyGanttTaskCollection is created.
    Unfortunately, for the reason that GanttTask Children is of type IList<IGanttTask> there is no event available for items change notification. We would have to insert/remove items in both collections when adding or removing them.
    What I might suggest is implementing IGanttTask instead of inheriting GanttTask in the MyGanttTask class. This way we can include only the necessary fields needed and create Child collection of type MyGanttTask instead of IList<IGanttTask>. Then use these MyGanttTaskCollection<MyGanttTask> to populate the TasksSource of the RadGanttView.

    Regards,
    Polya
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top