Column collections for multiple GanttChartDataGrid control instances with Gantt Chart Light Library

When you need to display multiple instances of the same control base type such as GanttChartDataGrid or ScheduleChartDataGrid from Gantt Chart Light Library you may find that the columns are actually applied only to one loaded instance.

This behavior is caused by the fact that in order to allow developers to easily get started with our component we have set up a default column collection with the most important columns as a common resource shared by control instances for performance reasons, assuming that only one instance is to be displayed at a time due to their demanded output size, although we know it's against WPF resource usage guidelines to have an unshareable resource set up within a style definition as it would eventually be used in the logical or visual tree.

However, to easily resolve any column collection related issue when displaying multiple component instances, we suggest you to apply a simple workaround and define a custom column collection for each object instance:

<pdgcc:GanttChartDataGrid.Columns>
    <pdgcc:DataGridColumnCollection>
        <hd:DataTreeGridColumn Header="Task"/>
        <DataGridTextColumn Header="Start"
            Binding="{Binding Start, Mode=TwoWay, Converter={StaticResource DateTimeStringConverter}}"/>
        <DataGridTextColumn Header="Finish"
            Binding="{Binding Finish, Mode=TwoWay, Converter={StaticResource DateTimeStringConverter}}"/>
        <DataGridCheckBoxColumn Header="Is milestone" Binding="{Binding IsMilestone, Mode=TwoWay}"/>
        <DataGridCheckBoxColumn Header="Is completed" Binding="{Binding IsCompleted, Mode=TwoWay}"/>
        <DataGridTextColumn Header="Assignments" Binding="{Binding AssignmentsContent, Mode=TwoWay}"/>
        [...]
    </pdgcc:DataGridColumnCollection>
</pdgcc:GanttChartDataGrid.Columns>

In the code above, hd XML namespace prefix is for DlhSoft.Windows.Controls namespace of DlhSoft.HierarchicalData.WPFLight.Controls assembly, and pdgcc refers the same namspace of the main DlhSoft.ProjectData.GanttChart.WPFLight.Controls assembly (assuming that the WPF output platform is used).

Remember that if you omit the second line in the example above (DataGridColumnCollection instantiation) you will only be adding columns to the default column collection, so be careful!