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.

Model.AppendChild vs Controller.ExecuteCommand(insCmd)

Thread ID:

Created:

Updated:

Platform:

Replies:

30538 Jun 20,2005 08:37 AM Jun 21,2005 10:55 AM Windows Forms 2
loading
Tags: Diagram
Richard Deverson
Asked On June 20, 2005 08:37 AM

I wish to add a symbol to a diagram programmatically. It appears that both the following alternatives achieve the same thing, with the exception that AppendChild requires DiagramRefresh() to be called. Are there any significant differences between these two approaches? What is the recommended approach from syncfusion? //Append Child variant SymbolPalette palette = paletteGroupBar.GetPalette(0); CustomSymbolModel symbolModel = palette.GetChild(0) as CustomSymbolModel; Symbol newSymbol = symbolModel.CreateSymbol(); newSymbol.X = 20; newSymbol.Y = 40; diagram.Controller.Model.AppendChild(newSymbol); //A refresh is needed before the new symbol appears. diagram.Refresh(); //Execute command variant SymbolPalette palette = paletteGroupBar.GetPalette(0); CustomSymbolModel symbolModel = palette.GetChild(0) as CustomSymbolModel; Symbol newSymbol = symbolModel.CreateSymbol(); NodeCollection nodes = new NodeCollection(); nodes.Add(newSymbol); InsertNodesCmd insCmd = new InsertNodesCmd(); insCmd.Location = new Point(30, 50); insCmd.Nodes.Concat(nodes); diagram.Controller.ExecuteCommand(insCmd);

Administrator [Syncfusion]
Replied On June 20, 2005 10:12 AM

I''m thinking that the difference is with ExecuteCommand you have the ability to undo, while you can''t with AppendChild :)

Administrator [Syncfusion]
Replied On June 21, 2005 10:55 AM

As Kevin pointed out, using the Essential Diagram Command classes through the Controller will append the executed command to the diagram''s undo/redo stack providing you with the ability to undo the operation if necessary. Regards, Prakash Surendra Syncfusion Inc.,

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.

;