We prepared a sample project for you which we hope can be a good starting Point. Basically, it is based on our MVVM sample in our XAML GutHub Reporistory. We added a DiagramToolBox in the sample. Please have in mind the following key points:
- The GraphSource inherits from SerializableGraphSourceBase<NodeViewModelBase, Link> which is a type of ObservableGraphSourceBase which better supports Save / Load scenarios.
- Brand inherits from ContainerNodeViewModelBase<object>. When you drop a container from the ToolBox, the diagram publishes DeserializeNode method in the SerializableGraphSourceBase and you can instatntiate an ssociate ViewModel:
NodeViewModelBase DeserializeNode(IShape shape, Telerik.Windows.Diagrams.Core.SerializationInfo info)
NodeViewModelBase node =
Then it is automatically added to the GraphSource.
Please check out the application and let us know if you need further assistance. The following help article might also be worth reading.
How To Serialize a DataBound Diagram
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>