New to Telerik UI for WPF? Download free 30-day trial

Bind Custom Task's Properties in Event Container

Environment

Product Version 2019.2.510
Product RadGanttView for WPF

Description

How to set the background color for each individual task by databinding a property on a custom GanttTask class.

Solution

To achieve the desired result, you need to bind the Color property through the OriginalEvent property of the EventProxy class which is the DataContext of the EventContainer.

<telerik:ColorToBrushConverter x:Key="ColorToBrushConverter" /> 
<Style TargetType="telerik:EventContainer"> 
    <Setter Property="Background" Value="{Binding OriginalEvent.Color, Converter={StaticResource ColorToBrushConverter}}" /> 
</Style> 

If your Color property is not of the Brush type, you will also need to use an adequate converter.

In this article