Highlighting critical path in Gantt Chart Library and Project Management Library for WPF

We use data binding to custom task data item objects within Gantt Chart Library for WPF or Project Management Library for WPF. How can we highlight critical tasks, as casting custom item objects to TaskItem (as indicated within the DlhSoft Critical Path sample application) wouldn't work?

If your custom task data item class inherits from DependencyObject, you should cast your custom item objects to DependencyObject type instead of TaskItem, and set GanttChartView.StandardBarFill and other similar property values to those objects, similar to our Critical Path sample application.

If you cannot inherit your task data item class from DependencyObject for any reason, it is possible to set up the brush of the task directly to the internal managed Task objects (which are always inheriting from DependencyObject), but in this case you should NOT set IsItemAppearanceApplied to true anymore, as appearance properties are not set at item level, but directly to the managed task object level:

foreach (Task task in criticalPathTasks)
{
    GanttChartView.SetStandardBarFill(task, criticalPathFill);
    [...]
}

// Removed: GanttChartTaskListView.IsItemAppearanceApplied = true;