public void Collapse(NonterminalExpanded control)
        {
            StackPanel parent = (control.Parent as StackPanel);
            if (parent == null)
                throw new Exception("The controls parent is not of type stack panel");

            // draw collapsed control
            GrammarNodeVDrawVisitor visitor = new GrammarNodeVDrawVisitor();
            visitor.visit(control.ReferenceTail);

            // get the index of the nonterminal collapsed that wants to expand
            int index = parent.Children.IndexOf(control);
            if (index < 0)
                throw new Exception("Cant find child in my stack panel, uh oh!");

            parent.Children.RemoveAt(index);
            parent.Children.Insert(index, visitor.DrawnItem);
        }