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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add a label to a SymbolPaletteItem in WPF?

Thread ID:

Created:

Updated:

Platform:

Replies:

80663 Apr 21,2009 01:29 PM UTC Apr 21,2009 07:18 PM UTC WPF 1
loading
Tags: Diagram
Kevin Ashley
Asked On April 21, 2009 01:29 PM UTC

How to add a label to a SymbolPaletteItem in WPF, when it's on the palette itself?


Nikhil A [Syncfusion]
Replied On April 21, 2009 07:18 PM UTC

Hi Kevin,

Thanks for your interest in Syncfusion products.


A label can be added to the SymbolPaletteItem only as a content of the Item in the following way:

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

A SymbolpaletteItem can hold only one type of content at a time. We currently do not have any Label property for the SymbolPaletteItem as we have for the Nodes.This has been confirmed as a Feature Request. We will implement this feature in our forthcoming new version releases or service pack releases. We usually have an interval of at least three months between releases. The feature implementationwould also greatly depend on the factors such as product design, code compatibility and complexity. We will provide a Label property for the Item so that apart from the content being hosted you can also provide a label.

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 page. So in this case, the SymbolPaletteItem's content can be assigned as the label of the node on the page in the following way:

A name can be assigned to the item. This name becomes the name of the dropped node.


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")
{

evtArgs.DroppedNode.Label = (evtArgs.DroppedNode.Content as Label).Content.ToString();

}

}

In this way identifying an item based on its name allows the user 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.

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

;