We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Get selected model item from diagram

Thread ID:

Created:

Updated:

Platform:

Replies:

124353 Jun 2,2016 01:35 PM Jun 8,2016 08:52 AM WPF 6
loading
Tags: Diagram
James Randle
Asked On June 2, 2016 01:35 PM

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.

Many thanks,
James.

James Randle
Replied On June 2, 2016 01:42 PM

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!

James.

James Randle
Replied On June 2, 2016 01:52 PM

In fact, please can you tell me how to do this for both DiagramControl, and the newer SfDiagram?

Thanks!
James.

James Randle
Replied On June 2, 2016 05:18 PM

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.

Suresh Shanmugam [Syncfusion]
Replied On June 6, 2016 08:32 AM

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.

Regards,
Suresh Shanmugam

Attachment: Get_Selected_ModelItem_b7f64a9.zip

James Randle
Replied On June 6, 2016 10:44 AM

Hi Suresh,
Thanks for your reply.

Can I have an example for the DiagramControl (classic) please.

Many thanks,
James.

Ranjitha Amirthalingam [Syncfusion]
Replied On June 8, 2016 08:52 AM

Hi James, 
 
We have provided sample to get the selected model item from Diagram Control (Classic) . Please refer to the sample from the following link. 
 
Sample Link: Classic_Sample
 
 
 
 
Regards, 
Ranjitha A. 


CONFIRMATION

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.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;