Maybe I am doing something wrong, but I am evaluating this product and think my needs can be achieved.
What I am trying to do is the following.
I have some Nodes on my Diagram.
I want to create a new Node which is a SubGraph.
Then I want the already existing nodes to be in that new group/subgraph.
What is did is:
Create a new subgraph node:
BaseClass newNode = new BaseClass()
{
Category = “GroupTemplate”,
IsSubGraph = true,
Id = sGroupId,
Key = sGroupId,
Name = “Group”,
};
then for each selected node on the graph i set the properties to be into that group. But they still are outside the group.
foreach (Node nod in myDiagram.SelectedParts.OfType())
{
BaseClass Shape = (BaseClass)nod.Data;
Shape.SubGraphKey = sGroupId;
newNode.MemberKeys.Add(Shape.Id);
}
sgmodel.AddNode(newNode);
AH well…now it seems to work suddenly…
Be sure to create the subgraph data and add the keys to it within a transaction.
In general, any change to the model should be performed within a transaction. The only common exception is when initializing a model, before the model has been assigned to a diagram.
On a different issue: are you using multiple DataTemplates for your groups? If not, you don’t need to set Category = “GroupTemplate” on the data. You just set Diagram.GroupTemplate to be the only DataTemplate for Groups.
Walter, Thanks for your reply.
I was doing indeed my changes within a transaction.
For now I am using just 1 group template but later in my project (when we decide to buy) I will use different onces, so just that I have implemented it already :)