This is a migrated thread and some comments may be shown as answers.

IGanttTask implementation

5 Answers 111 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
Paweł
Top achievements
Rank 1
Paweł asked on 11 Sep 2012, 06:56 AM
Hi,

I asked about this in other thread but I believe that this deserves for own one.

I'm trying to bind custom objects to RadGanttView. I know that such objects should either inherit from GanttTask class or implement IGanttTask interface. 
The first option is very easy - just inherit from GanttTask and add desired properties. When I do that, everything works ok.
Second option isn't so simple - when I'm trying to implement IGanttTask interface, RadGanttView loads and is visible, but when I put mouse cursor over any task, IE debugger window pops up and message is shown:

SCRIPT5022: Unhandled Error in Silverlight Application 
Code: 4004    
Category: ManagedRuntimeError       
Message: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   ved System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   ved System.Windows.ResourceManagerWrapper.GetResourceForUri(Uri xamlUri, Type componentType)    

I wonder why is that when I inherit from the class, everything is ok, but when I implement interface, problem occurs. Maybe there are some tricks that I'm not aware of?

Thank you in advance for the answer
Paweł

5 Answers, 1 is accepted

Sort by
0
Ventzi
Telerik team
answered on 11 Sep 2012, 06:16 PM
Hi Pawel,

Thank you for contacting us.

We are not aware of this issue. Would you please provide us a sample project where we can reproduce this? Does this problem occur only in IE or in the other browsers as well?

Regards,
Ventzi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Paweł
Top achievements
Rank 1
answered on 14 Sep 2012, 06:26 AM
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?



0
Accepted
Yana
Telerik team
answered on 14 Sep 2012, 01:40 PM
Hi Paweł,

First, you are right about the missing documentation about IGanttTask implementation.  This topic will be definitely added to the RadGanttView documentation soon.

As to reporting bugs - the most efficient way is to open a Bug Report ticket and explain the issue there. Also in the ticket you can attach a sample project demonstrating exactly the problem.

Of course, you can report bugs in the forums as well. But note that in the forums it is allowed to attach only images. Also most of the time we are checking all the threads, but we do not guarantee 100% reply there.

Kind regards,
Yana
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Paweł
Top achievements
Rank 1
answered on 17 Sep 2012, 12:54 PM
Hi Yana,

Could you confirm that "bug ticked" that you mentioned can be found under:
Home / Get Support / Available Support List 

?

If so, then I cannot report a bug due to one of the following reasons: (...)

That's a strange policy - I'd like to help Telerik to develop valid products, but it is impossible for me due to lack of support package...
Or maybe I'm wrong and bug report is located elsewhere?
Regards
Paweł
0
Yana
Telerik team
answered on 18 Sep 2012, 11:00 AM
Hi Paweł,

Yes, the Bug Report is under Get Support section and is available only to customers with an active support package.

As I mentioned in the previous post, you could always report bugs in our forums. Also you will receive Telerik points for this in the same way as in the tickets. The only disadvantage is that it is not allowed to attach projects in the forum threads.

Kind regards,
Yana
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

Tags
GanttView
Asked by
Paweł
Top achievements
Rank 1
Answers by
Ventzi
Telerik team
Paweł
Top achievements
Rank 1
Yana
Telerik team
Share this question
or