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

How to determine which SymbolPaletteItem was dropped on the view?

Hi, can you recommend the best way to determine what shape (SymbolPaletteItem) was dropped on the view? Thanks!


1 Reply

NA Nikhil A Syncfusion Team April 21, 2009 07:25 PM UTC

Hi Kevin ,

I have explained this in the other thread in which you asked about adding a label to the item. However for your convenience I have posted the response in this thread too.

In our upcoming release(Volume 2) of EssentialDiagram which is scheduled to be in the next week, we have provided the support to identify the nodes being dropped on the page. The Name property of the SymbolPaletteItem can be used to identify the dropped node in the NodeDrop event as it becomes the name of the node on the page. This is particularly useful when you have to identify the item which was dropped and perform some operation on the node before it gets added to the view.

A name can be assigned to the item:

SymbolPaletteItem ss = new SymbolPaletteItem();
Label l = new Label();
l.Content = "Label";
ss.Content = l;
ss.Name="MyItem";


The NodeDrop event can be declared:

diagramView.NodeDrop += new NodeDroppedEventHandler(diagramView_NodeDrop);


Event Handler:

void diagramView_NodeDrop(object sender, NodeDroppedRoutedEventArgs evtArgs)
{
if(evtArgs.DroppedNode.Name=="MyItem")
{
//user specifeid code
}

}

In this way identifying an item based on its name allows us to change the content or perform any operation on the node before it gets added to the page.

Please let us know if you have any queries or concerns.

Regards,
Nikhil.


Loader.
Live Chat Icon For mobile
Up arrow icon