I am struggling getting to the contents (children) of a Container using C#. Works fine if just drawn on the page, but once converted to a master, it is no longer recognized as a 'container'.
So, for example. Create a new container from the 'Insert' tab. From the 'Home' tab, draw 2 rectangles in the container, type some text in each, and then 'add to underlying container'.
After this, the code below reports the 2 rectangle Names & Texts.
However, I now drag the container into my stencil to create a master. Then I drag the master to the page to create an instance.
Now the code does not find any MemberShapes at all.
What am I doing wrong ? Any advice/guidance appreciated !!
    foreach (Microsoft.Office.Interop.Visio.Shape shape in Globals.ThisAddIn.Application.ActivePage.Shapes)
                {
                    System.Diagnostics.Debug.WriteLine(shape.Name);
                    if (shape.ContainerProperties != null) {
                        foreach (int memberID in shape.ContainerProperties.GetMemberShapes(0)) {
                            Microsoft.Office.Interop.Visio.Shape vsoShape = Globals.ThisAddIn.Application.ActivePage.Shapes.ItemFromID[memberID];
                            Debug.Print(vsoShape.Name);
                            Debug.Print(vsoShape.Text);
                        }
                    }
}