Getting Started with WPF Timeline
This topic will walk you through the creating of RadTimeline.
Assembly References
In order to use RadTimeline control in your project you have to add references to the following assemblies:
- Telerik.Windows.Controls.dll
- Telerik.Windows.Controls.DataVisualization.dll
- Telerik.Windows.Data.dll
You can include the control in your page by either dragging it from the toolbox in Visual Studio or manually creating the control. Example 1 demonstrate how to create RadTimeline in XAML.
Example 1: Creating RadTimeline control
<telerik:RadTimeline PeriodStart="2016/01/01"
PeriodEnd="2016/06/01"
VisiblePeriodStart="2016/01/01"
VisiblePeriodEnd="2016/03/22"
StartPath="Date"
DurationPath="Duration">
<telerik:RadTimeline.Intervals>
<telerik:MonthInterval />
<telerik:WeekInterval />
<telerik:DayInterval />
<telerik:HourInterval />
</telerik:RadTimeline.Intervals>
</telerik:RadTimeline>
Figure 1: RadTimeline visualization
RadTimeline items
The RadTimeline control presents its data in two types of occurrences(events). The first one is a one-time occurrence which happens once in a time. The second type represents periodical occurrence. It requires a strict Start and End time to be presented.
Figure 2: RadTimeline items visualization
More information about how to populate the control with TimelineItems and TimelineInstantItems can be found in the DataBinding help article in our documentation.
Setting a Theme
The controls from our suite support different themes. You can see how to apply a theme different than the default one in the Setting a Theme help article.
Changing the theme using implicit styles will affect all controls that have styles defined in the merged resource dictionaries. This is applicable only for the controls in the scope in which the resources are merged.
To change the theme, you can follow the steps below:
Choose between the themes and add reference to the corresponding theme assembly (ex: Telerik.Windows.Themes.Windows8.dll). You can see the different themes applied in the Theming examples from our WPF Controls Examples application.
-
Merge the ResourceDictionaries with the namespace required for the controls that you are using from the theme assembly. For the RadTimeline, you will need to merge the following resources:
- Telerik.Windows.Controls
- Telerik.Windows.Controls.DataVisualization
Example 2 demonstrates how to merge the ResourceDictionaries so that they are applied globally for the entire application.
Example 2: Merge the ResourceDictionaries
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/System.Windows.xaml"/>
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.xaml"/>
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.DataVisualization.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Alternatively, you can use the theme of the control via the StyleManager.
Figure 2 shows a RadTimeline with the Windows8 theme applied.