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.
Syncfusion Feedback

Get symbolitem from sfdiagram

Thread ID:

Created:

Updated:

Platform:

Replies:

124686 Jun 22,2016 07:27 PM UTC Jun 29,2016 07:00 AM UTC WPF 5
loading
Tags: SfDiagram
Alex
Asked On June 22, 2016 07:27 PM UTC

Hello! I am using Stencil and Sfdiagram. First of all I add SymbolItem to stencil like this:
 SymbolItem s_item = new SymbolItem();
   ...
   NodeViewModel node = new NodeViewModel()
{...};
  s_item.Symbol = node;
 ((SymbolCollection)stencil.SymbolSource).Add(s_item);
1. Then after adding an item from the stencil to the sfdiagram I want to get information about s_item. How can I do this?
2. After adding the same item 2 time I want to use s_item not as reference but as separate object. Could you help me?

Keerthivasan Ramamoorthy [Syncfusion]
Replied On June 23, 2016 11:34 AM UTC

Hi Alex, 
Thank you for contacting Syncfusion support. 
Please find the response to your query as below. 
S.no 
Query 
Response 
1 
Then after adding an item from the stencil to the sfdiagram I want to get information about s_item. How can I do this?

 
We have a support to achieve your requirement by using ItemAdded event for SfDiagram. Please find the code example as below. 
Code example: 
//ItemAdded Event for SfDiagram 
(Diagram.Info as IGraphInfo).ItemAdded += MainWindow_ItemAdded; 
 
void MainWindow_ItemAdded(object sender, ItemAddedEventArgs args) 
{ 
   if (args.Item is INode) 
    { 
 
     NodeViewModel nvm = (args.Item as NodeViewModel); 
 
    } 
 
} 
Here, 
Diagram is Instance of SfDiagram. 
nvm is dropped Node item. 
 
 
2 
 After adding the same item 2 time I want to use s_item not as reference but as separate object. Could you help me? 
We will clone the object when Drag and drop the object form Stencil to Diagram. 

 
Note: 
If our provided information is different from your requirement, please provide a screen short or sample to represent your requirement.   
  
 
Regards, 
Keerthivasan R.

Alex
Replied On June 23, 2016 05:38 PM UTC

Thanks.
1) Maybe my question was not clear so
 SymbolItem s_item = new SymbolItem();
  item.Key = content;
   ...
   NodeViewModel node = new NodeViewModel()
{...};
  s_item.Symbol = node;
 ((SymbolCollection)stencil.SymbolSource).Add(s_item);
How can I get object content(that is bold) from NodeViewModel then?
2) got it

Ranjitha Amirthalingam [Syncfusion]
Replied On June 27, 2016 12:49 PM UTC

Hi Alex, 
 
 
We have used Key property of ISymbol for custom purpose like searching the Symbols. We have also used key property for NodeViewModel, you can use this instead of using Key property of ISymbol. Also, we have a suggestion to use Custom property by creating Derived(Custom) NodeViewModel. 
 
 
 
 
 
Regards, 
Ranjitha A. 


Alex
Replied On June 28, 2016 06:59 PM UTC

Ok, thank you!

Keerthivasan Ramamoorthy [Syncfusion]
Replied On June 29, 2016 07:00 AM UTC

Hi Alex, 

 

Thanks for the update . 

Please let us know if you need any further assistance. 

 

Regards, 

Keerthivasan R. 



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.

Warning Icon 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.Close Icon

;