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.

How to determine which SymbolPaletteItem was dropped on the view?

Thread ID:

Created:

Updated:

Platform:

Replies:

80666 Apr 21,2009 10:37 AM Apr 21,2009 03:25 PM WPF 1
loading
Tags: Diagram
Kevin Ashley
Asked On April 21, 2009 10:37 AM

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


Nikhil A [Syncfusion]
Replied On April 21, 2009 03:25 PM

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.


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.

;