I'm evaluating Syncfusion.SfDiagram.WPF version 18.2.0.58 to see if it can be used in our existing project running on .NET Core 3.1 to display a hierarchical tree of connected nodes. I found the DataSource settings and hooked in my existing collection of objects with some added fields for Id and ParentId but I keep getting ArgumentOutOfRangeExceptions when adding items to the collection. I'm using DynamicData's collections which has a extended version of the ObservableCollection.
What I noticed was a few things in how the Diagram DataSource handles changes in the collection:
- If I add many items at once to the DynamicData collection it will send a CollectionChanged Reset action with the collection in sender. The Diagram DataSource resets its own collections but doesn't refresh the data from the source. This will cause issues later on when new data is added and CollectionChanged Add action is received with new items starting at a higher index than what the Diagram DataSource has since it hasn't updated its own collections.
- If multiple items are added or removed in the same CollectionChanged event the Diagram DataSource only adds/removes the first item.
Both of these things causes the Diagram to loose sync with the source collection.