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. Image for the cookie policy date
close icon

Get symbolitem from sfdiagram

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?

5 Replies

KR Keerthivasan Ramamoorthy Syncfusion Team 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.


AL Alex 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


RA Ranjitha Amirthalingam Syncfusion Team 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. 



AL Alex June 28, 2016 06:59 PM UTC

Ok, thank you!


KR Keerthivasan Ramamoorthy Syncfusion Team 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. 



SIGN IN To post a reply.
Loader.
Live Chat Icon For mobile
Up arrow icon