Good Day,
A scenario I don't seem to be able to get right, is to update a diagram node at runtime, using "local data" bindings.
1. I have a DataSource defined as ObservableCollection<DiagProdLineBase>
2. The DiagProdLineBase class has a Text property defined, which is mapped in the DiagramDataMapSetting tag as an annotation (see below)
3. The diagram renders correctly the first time it's drawn
4. After initial render, I change one instance of the DataSource collection, updating the text property of one of the DiagProdLineBase instances.
5. I would have then assumed, that the Diagram picks up on the change and updates the node annotation
I have tried Diagram.DataBind, StatehasChanged, with no update
I have tried to modify the Diagram Nodes collection directly on the Diagram object (updating Annotation and even the JSON Data property). No success.
The only thing that works, is calling Diagram.Clear() and then Diagram.Refresh(), but I would assume there is a more elegant way.
What am I missing? How do I signal to the Diagram control, that it needs to re-bind to the data source?
Thank you,
Peter
<SfDiagram @ref="@Diagram" id="diagram" Width="100%" Tool="@DiagramTools.ZoomPan" Height="580px" NodeDefaults="@NodeDefaults" ConnectorDefaults="@ConnectorDefaults" Layout="@LayoutValue">
<DiagramDataSource Id="Id" ParentId="ParentItems" DataSource="@DataSource">
<DiagramDataMapSettings>
<DiagramDataMapSetting Property="Annotations[0].Content" Field="Text"></DiagramDataMapSetting>
<DiagramDataMapSetting Property="Style.fill" Field="FillColor"></DiagramDataMapSetting>
<DiagramDataMapSetting Property="Style.strokeColor" Field="Border"></DiagramDataMapSetting>
</DiagramDataMapSettings>
</DiagramDataSource>
<DiagramPageSettings>
<DiagramFitOptions CanFit="@CanFit" Mode="@Mode"></DiagramFitOptions>
</DiagramPageSettings>
<DiagramSnapSettings Constraints="SnapConstraints.None"></DiagramSnapSettings>
</SfDiagram>