Hi again,
Sorry for delay. I found the cause of error I described in my previous post. Detailed description below:
I have Activity class that represents one task. I'd like to show all of my activities in Gantt chart. There is also no way to inherit from GanttTask, as Activity class inherits from other class. So I decided to implement IGanttTask.
As we know, this interface has members:
Deadline, Dependencies, Description, Duration, Progress and Title which are quite obvious.
But it also derives from other interfaces, such as IDateRange, IResourceContainer, INotifyPropertyChanged, IHierarchicalResource, IHierarchical and IResource, so we have to implement also Relations, End, Start, Resources, TypeKey and Children.
As I couldn't find detailed description of the last properties, I just left them in the most straighforward way, for example:
public IList Resources { get { return new List<Activity>(); } }
public object TypeKey { get { return new object(); }}
This kind of implementation was wrong and error was thrown. I couldn't find any description of proper implementation
of IGanttTask, so I used JustDecompile to check how the GanttTask implements IGanttTask. What I found is that
Resources and TypeKey should be implemented like this:
private IList _Resources;
public IList Resources{ get { return _Resources; } }
public object TypeKey{ get { return typeof(IGanttTask); }}
and in ctor, we should add:
_Resources = new List<IResource>();
_Resources.Add(this);
When I changed my code accordingly, it started to work, and no exception is thrown.
I wrote this post because I believe that there may be many developers that experienced or will experience this problem
and there is not much documentation available...
Best regards
Paweł
PS: One more thing - where can I report possible bugs in the Gantt chart?