Hi, Using your 'Diagram Binding With TreeView' sample, which creates a diagram via data binding to objects inherited from ObservableCollection<>, please can you explain how to get the selected MODEL item? I can access the selected view item via DiagramControl.View.SelectionList, but I cannot find out how to access the corresponding MODEL item, eg the ObjectTree class that is associated with the Node that I get from DiagramControl.View.SelectionList.
Essentially, what I am trying to do is create a custom ContextMenu for the Nodes in a diagram, that is dynamically populated when it is shown. In order to do decide what items to add to the menu before it is shown, I need to know what the underlying MODEL object is, so that i can inspect its properties.
So if you could extend the 'Diagram Binding With TreeView' sample so I can right click a node, click on a menu item, and display a property of the corresponding MODEL object, that would be amazing, and very useful for other people too!
JRJames RandleJune 2, 2016 05:52 PM UTC
In fact, please can you tell me how to do this for both DiagramControl, and the newer SfDiagram?
JRJames RandleJune 2, 2016 09:18 PM UTC
Also, I just tried the SfDiagram example on the following page, and it doesn't work. https://www.syncfusion.com/forums/119563/sfdiagram-vs-diagramcontrol
I get the following errors: Error 224 Type 'DirectedTreeLayout' is not usable as an object element because it is not public or does not define a public parameterless constructor or a type converter. Error 212 The type "DirectedTreeLayout" does not include any accessible constructors. Error 223 The type 'syncfusion:LayoutManager' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
I have the following references added ...
Please help! James.
SSSuresh Shanmugam Syncfusion Team June 6, 2016 12:32 PM UTC
Hi James Randle,
Thanks for using Syncfusion Products.
We have prepared the sample based on to get the selected model item from SfDiagram. Please find the sample in the following location.