TimelineControl is built from two layers:
- Items layer
- Connections layer
The Items layer display TimelineItem(s) control which represent the data you want to visualize.
Depend on the ItemsPanel property of the TimelineControl (the value must be instance of class that derive from TimelinePanel) the TimelineItem will be arranged. Usually they are arranged according to their StartDate and EndDate attached properties.
The Connections layer display the connections between the items.
So if for example you want to display dependencies between tasks on gantt chart, the connections will show arrows going from the prior task to the dependent task.
Item in TimelineControl represent data that start at specified time and ends at a specified time. Each data item is wrapped in TimelineItem class.
TimelineItem visual aspect can be define in two parallel ways: DataTemplte and Style.
If you create a DataTemplate with Key value set to the type of your data item then WPF will automatically use that DataTemplate to visualize your data item.
On the other hand WPF does not have the same mechanism for style, so I've add it myself. Unless you set a specific ItemContainerStyleSelector for your TimelineControl I provide you with default instance of
. This StyleSelector is use to set the Style of each TimelineItem according to the type of the data item is represent.
Connections in TimelineControl represent relation between two items. Each connection is wrapped in Connection class.
Since TimelineControl handle the visual aspect of connection it was not an option to use DataTemplate in this case.
On the other hand, you still want to be able to choose the color of the connection, context menu, event handlers and any other property. So as in TimelineItem, I use
to allow you to easily define a Style in XAML with Key set to the type of data the connection represent and in that style you can define Setter and Triggers to control the visual aspect of the connection.