progammatically add a symbol from the palette

Please can you tell me how to add a symbol from the palette via code.

Ultimately, i want to populate a context menu (via right click mouse button) with each of the items from the palette and allow the user to add nodes from this.

The Help contains the following which i guess must be out of date:

How can I progammatically add a symbol from the palette?

The following code sample demonstrates how you can progamatically add a symbol from the symbol palette to a Diagram.


[C#]

//New InsertNodesCmd
InsertNodesCmd insCmd = new InsertNodesCmd();

//Select the Symbol from the PaletteGroupView
this.paletteGroupView1.SelectSymbolModel(this.paletteGroupView1.GroupViewItems[1].Text);
SymbolModel symModel = this.paletteGroupView1.SelectedSymbolModel;

//New NodeCollection
NodeCollection nodes = new NodeCollection();

//Add Symbol to the NodeCollection
if (symModel != null)
{
Symbol triangle = symModel.CreateSymbol();
nodes.Add(triangle);

}
insCmd.Nodes.Concat(nodes);
insCmd.Location = new PointF(125,125);
//ExecuteCommand to add the Symbol
this.diagram1.Controller.ExecuteCommand(insCmd);






2 Replies

PM Peter Mcintosh June 24, 2008 08:48 AM UTC

Sorry, this has been posted in the wrong forum. I have added this post to the diagrams forum.




MA Manohari Syncfusion Team June 25, 2008 07:03 AM UTC

Hi,

Thanks for the update. And Thanks for your interest in Syncfusion products.

Regards,
Manohari.R


Loader.
Up arrow icon