We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Control to create a document outline

Thread ID:

Created:

Updated:

Platform:

Replies:

103672 May 23,2012 03:21 PM UTC May 29,2012 08:34 PM UTC WinForms 1
loading
Tags: FAQ
Bhavya
Asked On May 23, 2012 03:21 PM UTC

Hi,

I am looking forward to implement a document outline available in visual studio (view->otherwindows->Document Outline) which will list all the control on the designer (I have a custom designer) in a hierarchical form. I looked at a control named "Document explorer", but could not understand how this control can be used and if this can suite what I am looking for.

Thanks


Davis Jebaraj [Syncfusion]
Replied On May 29, 2012 08:34 PM UTC

Hi Bhavya,

 

You need to use a TreeView control to implement your own Document outline control. The document explorer you are referring to is specific to the Diagram control and is derived from TreeView to load nodes specific to the Diagram. Please find a code snippet of the code that parses the Diagram document and adds the representative nodes to the tree.

 

private void ParseChildren(Layer layer, TreeNode nodesParent)

        {

            foreach (INode node in layer.Nodes)

            {

                ParseNode(node, nodesParent);

            }

        }

 

        private void ParseNode(INode nodeCur, TreeNode nodesParent)

        {

            // Create corresponding TreeNode

            TreeNode nodeTreeTemp = new TreeNode(nodeCur.Name);

            nodeTreeTemp.Tag = nodeCur;

           

            // if nodeCur is CompositeNode

            // reflect its hierarchy

            if (nodeCur is ICompositeNode)

            {

                ICompositeNode nodeComposite = nodeCur as ICompositeNode;

 

                if (nodeComposite != null)

                {

                    // Parse composite node's children

                    nodeTreeTemp.ImageIndex = 2;

                    nodeTreeTemp.SelectedImageIndex = 2;

                    ParseChildren(nodeComposite, nodeTreeTemp);

                    nodeTreeTemp.Text = (nodeComposite as INode).Name + " (" + nodeComposite.ChildCount + ")";

                }

            }

            else

            {

                nodeTreeTemp.Tag = nodeCur;

                nodeTreeTemp.ImageIndex = 1;

                nodeTreeTemp.SelectedImageIndex = 1;

            }

 

            // Add created TreeNode to nodesParent

            nodesParent.Nodes.Add(nodeTreeTemp);

        }

 

 

Regards,

 

Davis


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;