10143 : Ive setup my gantt chart to use a DataSet for its data source.What I would like to do is add text to each time item on the gantt. How?

Question

The OnNodeInserted function is called for each grid row. What I would like to do is add text to each time item on the gantt. How would I go about doing that? I have a GanttRow, but I’m not sure how to get the TimeItems from that GanttRow so I can add the TimeItemText.

Answer

For time items you willl find a TimeItemDataConnect for each layer.

It is the TimeItemDataConnect object that resolves the events in the datasource to actual time item property values. You can implement the TimeItemDataConnect.OnBeforeDSToTimeItem (the event is not available in the property grid but just type yourLayer.TimeItemDataConnect.OnBeforeDSToTimeItem+= and hit tab in VS)

In this event you can inspect that data from the datarow and you can do additional things on your time item, like setting a TimeItemLayout etc.

This event is also good for conversions, if you datarow has start and length instead of start and stop.

But this is also a perfect place to add a TimeItemText to the time item. Just check the collection of timeItemTexts on the time item so that you have not already added it…

Leave a Reply