Skip to main content
A newer version of this page is available. .

TimelineView.TimeScaleTemplateSelector Property

Gets or sets the data template selector which chooses a template based on the time scale type. This is a dependency property.

Namespace: DevExpress.Xpf.Scheduling

Assembly: DevExpress.Xpf.Scheduling.v18.2.dll

Declaration

public DataTemplateSelector TimeScaleTemplateSelector { get; set; }

Property Value

Type Description
DataTemplateSelector

A DataTemplateSelector descendant that is the time scale template selector.

Remarks

The Timeline View can be bound to a collection of objects containing time scale settings, described in a Model or ViewModel (using the TimelineView.TimeScalesSource property).

The Timeline View uses time scale templates to generate time scales. To choose the required template based on the time scale type, use the template selector assigned to the TimeScaleTemplateSelector property. If all time scales can be described using a single template, you have no need to create a time scale template selector. Instead, assign this template to the view’s TimelineView.TimeScaleTemplate property.

Example

The following example demonstrates how to specify time scales for the Timeline View using the MVVM architectural pattern.

Use the TimelineView.TimeScalesSource property to bind the view to a collection of objects containing time scale settings described in the ViewModel. The Timeline View generates time scales based on templates. Create multiple templates, one template for each time scale type. In this example, there are three time scale templates: WorkDayScaleTemplate, WorkHourScaleTemplate, and FixedTimeScaleTemplate.

To choose the required template based on the time scale type, create a template selector and assign it to the TimelineView.TimeScaleTemplateSelector property.

Imports System.Windows
Imports System.Windows.Controls
Imports System

Namespace WpfSchedulerTimelineScalesTemplate
    Public Class TimeScaleTemplateSelector
        Inherits DataTemplateSelector

        Public Property WorkDayScaleTemplate() As DataTemplate
        Public Property WorkHourScaleTemplate() As DataTemplate
        Public Property FixedTimeScaleTemplate() As DataTemplate
        Public Overrides Function SelectTemplate(ByVal item As Object, ByVal container As DependencyObject) As DataTemplate
            Dim timeScale As TimeScaleViewModel = TryCast(item, TimeScaleViewModel)
            Select Case timeScale.Type
                Case ScaleType.WorkDay
                    Return WorkDayScaleTemplate
                Case ScaleType.WorkHour
                    Return WorkHourScaleTemplate
                Case ScaleType.FixedTime
                    Return FixedTimeScaleTemplate
                Case Else
                    Throw New NotImplementedException()
            End Select
        End Function
    End Class
End Namespace

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the TimeScaleTemplateSelector property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also