Back to Devexpress

GanttView.TaskContentTemplate Property

wpf-devexpress-dot-xpf-dot-gantt-dot-ganttview-3fd4d8f1.md

latest2.8 KB
Original Source

GanttView.TaskContentTemplate Property

Gets or sets a template that defines the task content appearance. This is a dependency property.

Namespace : DevExpress.Xpf.Gantt

Assembly : DevExpress.Xpf.Gantt.v25.2.dll

NuGet Package : DevExpress.Wpf.Gantt

Declaration

csharp
public DataTemplate TaskContentTemplate { get; set; }
vb
Public Property TaskContentTemplate As DataTemplate

Property Value

TypeDescription
DataTemplate

A template that defines the task content appearance.

|

Remarks

Each task in the Gantt area displays a label with its name. If you want to display custom content, create a template and assign it to the TaskContentTemplate property:

xaml
<dxgn:GanttControl ItemsSource="{Binding Items}">
    <dxgn:GanttControl.Columns>
        <dxgn:GanttColumn BindTo="Name"/>
        <dxgn:GanttColumn BindTo="StartDate"/>
        <dxgn:GanttColumn BindTo="FinishDate"/>
    </dxgn:GanttControl.Columns>
    <dxgn:GanttControl.View>
        <dxgn:GanttView ...>
            <dxgn:GanttView.TaskContentTemplate>
                <DataTemplate>
                    <TextBlock Text="{DXBinding 'Row.ResourceName'}" />
                </DataTemplate>
            </dxgn:GanttView.TaskContentTemplate>
        </dxgn:GanttView>
    </dxgn:GanttControl.View>
</dxgn:GanttControl>

Use the TaskContentPosition property to specify the task content position.

You can implement a selector to apply the template according to custom logic. Refer to the following topic for more information: TaskContentTemplateSelector.

If View contains both TaskContentTemplate and TaskContentTemplateSelector, the GanttControl renders the template assigned to the TaskContentTemplate property.

See Also

TaskContentTemplateSelector

TaskContentPosition

TaskContentIndent

GanttView Class

GanttView Members

DevExpress.Xpf.Gantt Namespace