Try Gantt.zip
I believe these two sample files will work in both Silverlight 4 and WPF.
Actually implementing the data representing the activities and the DataTemplates for the nodes was pretty easy.
![]()
The OrangeRed nodes highlight the critical path.
Here’s how the data is defined:
new Activity() { Key=1, Row=row++, Text="Start", FromKeys=P(), Length=0, Start=0, Critical=true, Category="Start" },
new Activity() { Key=2, Row=row++, Text="a", FromKeys=P( 1 ), Length=4, Start=0, Critical=true },
new Activity() { Key=3, Row=row++, Text="b", FromKeys=P( 1 ), Length=5.33, Start=0 },
new Activity() { Key=4, Row=row++, Text="c", FromKeys=P( 2 ), Length=5.17, Start=4, Critical=true },
new Activity() { Key=5, Row=row++, Text="d", FromKeys=P( 2 ), Length=6.33, Start=4 },
new Activity() { Key=6, Row=row++, Text="e", FromKeys=P( 3, 4 ), Length=5.17, Start=9.17, Critical=true },
new Activity() { Key=7, Row=row++, Text="f", FromKeys=P( 5 ), Length=4.5, Start=10.33 },
new Activity() { Key=8, Row=row++, Text="g", FromKeys=P( 6 ), Length=5.17, Start=14.34, Critical=true },
new Activity() { Key=9, Row=row++, Text="Finish", FromKeys=P( 7, 8 ), Length=0, Start=19.51, Critical=true, Category="Finish" }
But I actually spent most of my time working on a feature that people sometimes ask for: the ability to zoom in and out only along the X axis, and without changing the size of the text.
This is implemented by data-binding the Node.Location using a converter that automatically scales the Point.X value by a factor.
There is another data-binding to control the Width of the Rectangle.
I also added a custom CommandHandler that handles control-mouse-wheel and keyboard zooming commands by changing that scale factor, instead of modifying Diagram.Scale as it normally would.