Hello,
we have a FlexyGantt with OverlappedTasksRenderingOptimization="ShrinkHeight" and a RowHeigtConverter. So if some tasks overlap the row height increases.
The user can collapse a row of the gantt via a toggle button.
To do this, TaskListBinding is bound to a CollectionView of the task items and the CollectionView filters all tasks out, resulting in MaxOverlappingBlocksRowCount set to 1.
The problem is that when the user expands the row MaxOverlappingBlocksRowCount is still 1 and the row cannot be calculated with the correct height.
I looked into the code and when the filter of the CollectionView is changed the event OnItemsChanged() in ChartChildren class is fired.
else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Reset)
{
this.blocks.Clear();
}
this.UpdateMaxOverlappingTasksCount();
When this.UpdateMaxOverlappingTasksCount() is called, this.blocks is empty and results in MaxOverlappingBlocksRowCount set to 1. The same action is fired when the filter repopulates the CollectionView.
The Microsoft documentation for NotifyCollectionChangedAction.Reset states:
"The contents of the collection changed dramatically."
This means that a large change occurred in the collection and it should be reevaluated completely. This can be a Clear() but it can also be a changing filter.
For a test I added the items again (e.NewItems is null in this case):
else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Reset)
{
this.blocks.Clear();
//test: readd items
if (tasksPanel != null)
{
foreach (TaskItemControl child in tasksPanel.Children)
this.OnNewEntityAdded(child);
}
}
This solved my issue, all items get added again when the filter adds them.
Would be great if you could include this fix.
Best regards