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

To get the base Node interface while dropping symbol

Hello! I use this article to get the base Node interface: https://www.syncfusion.com/kb/5880/how-to-get-the-base-node-interface-while-dropping-a-symbol-from-the-stencil-to-the-sfdiagram.
But despite despite the fact that I put some object into key:
          SymbolItem item = new SymbolItem();          
            NodeViewModel node = new NodeViewModel()        
            {
               ...
                Key = content
            };         
            item.Symbol = node;
            ((SymbolCollection)stencil.SymbolSource).Add(item);
I don't have an acces to it while dropping this symbol to the SfDiagram. It always is null (dropedItem.Key ==null). Another properties of the node are null too. Could you help me?

5 Replies

KR Keerthivasan Ramamoorthy Syncfusion Team July 12, 2016 09:07 AM UTC

 Hi Alex,  
  
 
Reported issue:” Key property became a null while dropping stencil on to the Diagram”.   
  
The reported issue has been already fixed and this fix were included in our volume 2, 2016 release. So please upgrade to the latest version to get the issue resolved. Please download the latest version from the below link. 
 
  
Regards, 
Keerthivasan R. 



AL Alex July 12, 2016 07:10 PM UTC

Hi! I installed the new version. I have two versions of syncfusion.sfdiagram.wpf: 14.2400.0.26 and 14.2450.0.26 now (by the way, why did it happened?). But it does't work  with none of them either.

Attachment: DroppedNode_a6935929.rar


KR Keerthivasan Ramamoorthy Syncfusion Team July 13, 2016 03:21 PM UTC

Hi Alex, 
 
We have analyzed your sample and this is a sample side issue. In sample, the width, height, shape, shape style and Binding style cannot be specified to the NodeViewModel that is the cause of the issue. Now, we have modified the sample as per your requirement.  Please refer to the below sample link. 
 
Sample link:DroppedNode_Modified
 
 
Note: 
Please refer to the below link to know more about usage of Binding style. 
 
Regards, 
Keerthivasan R.  



AL Alex July 13, 2016 04:40 PM UTC

Hello. But here:
 void MainWindow_ItemAdded(object sender, ItemAddedEventArgs args)
        {
            if (args.ItemSource == ItemSource.Stencil)
            {
                var dropedItem = args.Item as NodeViewModel;
                ///----------here I want to get "MyKeyObject"
                var d = dropedItem.Key; // is null
                if (dropedItem != null)
                {
                    INodePort port1 = addPort(dropedItem, 0.5, 0.5);
                    dropedItem.Ports = new ObservableCollection<INodePort>()
                         {
                            port1
                         };
                }
            }
        }
dropedItem.Key == null in your example too.
However I created symbols this way:
             NodeViewModel node = new NodeViewModel()
            {
                Key="MyKeyObject"...
                



KR Keerthivasan Ramamoorthy Syncfusion Team July 18, 2016 12:45 PM UTC

Hi Alex, 
 
Sorry for the inconvenience caused. 
 
We have deprecated the ISymbol dependency with Stencil, in order to provide support to add Node and Connector into Stencil. The Dependent Filter also updated with ISymbol dependency in Volume 1 2016 release. Based on the new API changes, we have modified the sample . Please refer to the below sample link. 
 
Sample Link:DroppedNode_Modified
 
 
Note: 
API changed: 
1)ISymbol->object, 
2)Filter->SymbolFilter 
symbolstencil.SelectedFilter = new SymbolFilterProvider() { SymbolFilter = Filter }; 
 
private bool Filter(SymbolFilterProvider sender, object symbol) 
{ 
return true; 
} 
 
Here, 
Symbolstencil is  instance of Stencil. 
 
 
 
Regards, 
Keerthivasan R. 

Loader.
Live Chat Icon For mobile
Up arrow icon