Thank Nagaraj. However, that was not what i was looking for. I was wanting to populate the diagrams context menu with each of the palette items so as i could add items to the diagram from the context menu.
The help (which was included in v6.3) stated that i could use "InsertNodesCmd" class as well as method "this.diagram1.Controller.ExecuteCommand()". I assume this is out of date?
I managed to get a working example by looping through each of the palettes:
//Iterate through the palettes and add menu items for each node found.
foreach (GroupBarItem item in this.symbolPaletteGroupBar.GroupBarItems) {
if (item.Client is PaletteGroupView) {
PaletteGroupView view = item.Client as PaletteGroupView;
foreach (Node n in view.Palette.Nodes) {
AddContextMenuItem(n);
}
}
}
I stored the palette node in the Tag of the context menu item. When the user clicked on a context menu item, i called the following method:
///
/// Adds a node to the diagram.
/// ///
private void InsertNode(Node node) {
Node newNode = (Node)node.Clone();
//We want to insert node onto diagram at mouse location
newNode.PinPoint = diagram.Controller.MouseLocation;
//Add node to diagram
this.diagram.Model.AppendChild(newNode);
}
I hope someone may find this usefull.
Thanks.