GoXam for WPF v3
AddNodeForData Method
Northwoods.GoXam Namespace > PartManager Class : AddNodeForData Method
the data in the model that holds node information
the model that the nodedata is in
Make sure a Node exists for some data in the model, added to the NodeLayer specified by its LayerName.
Syntax
public Node AddNodeForData( 
   object nodedata,
   IDiagramModel model
)

Parameters

nodedata
the data in the model that holds node information
model
the model that the nodedata is in

Return Value

the Node for the nodedata, either an existing one or a newly created one, or null if FilterNodeForData returns false or if the diagram is uninitialized
Remarks

If you want to add a node to your diagram programmatically, don't call this method, but create a node data object and add it to the model's Northwoods.GoXam.Model.IDiagramModel.NodesSource, either directly to that collection or by calling Northwoods.GoXam.Model.IDiagramModel.AddNode. Remember to wrap all model changes in a transaction.

If the diagram already has a Node for the data, as determined by FindNodeForData, this method returns that node.

If FilterNodeForData is false, this method will do nothing and return null.

For bound data this calls FindCategoryForNode to determine the category string to pass to FindTemplateForNode in order to get the DataTemplate. Once it has the category and the DataTemplate, this calls MakeNodeForData to actually allocate and initialize the Node or Group.

If the nodedata is a Node and if the model is a Northwoods.GoXam.Model.PartsModel, this method doesn't need to construct a new node by calling MakeNodeForData, but can just add the node to the diagram, in the appropriate Layer determined by the LayerName.

The implementation of this method should not modify the model.

See Also

Reference

PartManager Class
PartManager Members