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

Edit Labels

When working with a diagram element, is there any support for editing the label of an element in place? Do you have an example of this?

Thanks.


3 Replies

J. J.Nagarajan Syncfusion Team April 20, 2007 10:41 PM UTC

Hi Nelson,

Thanks for your interest in Syncfusion product. When you double click on the symbol you can edit the Symbol Label in v.4.4.0.51. Please refer to our SimpleFlow sample (C:\Program Files\Syncfusion\Essential Studio\4.4.0.51\Windows\Diagram.Windows\Samples\Symbol Design\SimpleFlow) for more details. In this sample when you double click on a sample you can edit the Label.

Please let me know if you have any questions.

Thanks,
Nagaraj


ND Nelson Druding April 23, 2007 09:30 PM UTC

Thanks Nagara,

Is there anyway of programmaticly forcing this? I want to put a menu item called "Rename" which edits the label. Any ideas?

Thanks,

-Nelsn

>Hi Nelson,

Thanks for your interest in Syncfusion product. When you double click on the symbol you can edit the Symbol Label in v.4.4.0.51. Please refer to our SimpleFlow sample (C:\Program Files\Syncfusion\Essential Studio\4.4.0.51\Windows\Diagram.Windows\Samples\Symbol Design\SimpleFlow) for more details. In this sample when you double click on a sample you can edit the Label.

Please let me know if you have any questions.

Thanks,
Nagaraj


J. J.Nagarajan Syncfusion Team April 23, 2007 10:51 PM UTC

Hi Nelson,

If your intention is to set the Symbol's label node to Edit mode, then you can achieve this by using the TextEdit .The TextEdit class implements a text box control for editing the text objects.

if(this.diagram1.Controller.SelectionList.Count != 0)
{
MySymbol symbol = this.diagram1.Controller.SelectionList.First as MySymbol;
symbol.EditStyle.AllowMove = false;
SymbolLabel lbl = symbol.GetChildByName("MyLabel") as SymbolLabel;
ILabelContainer lblContainer = symbol as ILabelContainer;
if (lbl != null && !lbl.ReadOnly)
{
if (lblContainer != null)
{
SizeF maxSize = lblContainer.GetLabelMaxSize(lbl);
Control parentControl = this.diagram1.Controller.ParentControl;
if (parentControl != null)
{
TextEdit editCtl = new TextEdit(this.diagram1.Controller.View, maxSize, true);
this.textEditor = editCtl;
// BeginEdit method is used to edit the specified node.
this.textEditor.BeginEdit(lbl);
editCtl.Focus();
parentControl.Refresh();
}
}
}
}

I have created a sample demonstrating this completely. In this sample when you click on File->Rename menuitem you can edit the label. After edit the label you can click File->EndEdit menuitem to end the edit mode.

You can download the sample from the following page.

http://websamples.syncfusion.com/samples/Diagram.Windows/F59761/main.htm

Please refer to the sample and let me know if you have any questions.

Thanks for using Syncfusion product.

Regards,
Nagaraj

Loader.
Live Chat Icon For mobile
Up arrow icon