I have a root Subgraph object with four child Subgraphs each containing a few Nodes. I have added all the Subgraphs and Nodes to the Graph and set the RootSubgraph on the Graph. However, when trying to draw the Graph I get a cast error from within the library (Microsoft.Msagl.GraphViewerGdi.Draw.cs, line 1044) where the GeometryNode of a Subgraph is cast to a Cluster. The GeometryNode is set to a Cluster in GeometryGraphCreator.ProcessSubgraphs and the error message gives me no information about why the cast fails. How can I fix this?
For now I've simply set the Label to null to avoid the drawing code but I would like to use a label eventually.
The problem was in my initialisation of the
Subgraph:Assigning the
Labelproperty this way skipped some extra set up code needed to correctly link theLabelwith theSubgraph. Leaving it out altogether lets the constructor handle theLabelitself.