|117640||Nov 20,2014 01:17 PM||Nov 21,2014 06:35 AM||WPF||1|
We have analyzed about your requirement “Diagram using Nonhierarchical data with ItemSource”. This can be achieved in Diagram WPF with manual Layout (ItemSource for Node) and utility for Connectors in Application level.
Node and connector property of diagram is read-only, items cannot be added or removed from it, but it cannot be assigned with a new collection.
We have ItemsSource property that supports data-binding, we can do two things using this property.
1. A collection of business object can be assigned to it, a view (Node) will be generated for each business object.
2. When a hierarchy of objects (nested collection) are assigned, based on HierarchicalDataTemplate, a tree will be generated based on the parent child relationship.
So, using 1st approach, Node can generated through databinding through ItemSource property.
But, connector cannot be binded with items source. But we can work around this binding with a utility class in application level.
Your requirement can be achieved in application level by deriving the DiagramControl and providing two properties for binding your Data. But, adding/removing of the Node and Connector based on the given data should be handled manually in application level.
Please let us know if you have further
assistance on this.
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.