private void treeControl_NodeSelectedChanged(object sender, TreeControl.NodeEventArgs e)
        {
            if (e.Node.Selected)
            {
                object item = e.Node.Tag;
                {
                    DomNode node = item as DomNode;
                    if (node != null)
                    {
                        // Build property descriptors for node's attributes
                        List <PropertyDescriptor> descriptors = new List <PropertyDescriptor>();
                        foreach (AttributeInfo attributeInfo in node.Type.Attributes)
                        {
                            descriptors.Add(
                                new AttributePropertyDescriptor(
                                    attributeInfo.Name,
                                    attributeInfo,
                                    "Attributes",
                                    null,
                                    true));
                        }

                        // use property collection wrapper to expose the descriptors to the property grid
                        m_propertyGrid.Bind(new PropertyCollectionWrapper(descriptors.ToArray(), node));
                    }
                    else // for NodeAdapters
                    {
                        // Treat NodeAdapters like normal .NET objects and expose directly to the property grid
                        DomNodeAdapter adapter = item as DomNodeAdapter;
                        m_propertyGrid.Bind(adapter);
                    }
                }
            }
        }
            public void GetInfo(object item, ItemInfo info)
            {
                info.IsLeaf = !HasChildren(item);

                DomNode node = item as DomNode;

                if (node != null && node.ChildInfo != null)
                {
                    info.Label = node.ChildInfo.Name;
                    //info.ImageIndex = info.GetImageList().Images.IndexOfKey(Resources.DomObjectImage);
                    return;
                }

                Adapter adapter = item as Adapter;

                if (adapter != null)
                {
                    DomNodeAdapter nodeAdapter = adapter.Adaptee as DomNodeAdapter;
                    StringBuilder  sb          = new StringBuilder();

                    Type type = nodeAdapter.GetType();
                    sb.Append(type.Name);
                    sb.Append(" (");
                    foreach (Type interfaceType in type.GetInterfaces())
                    {
                        sb.Append(interfaceType.Name);
                        sb.Append(",");
                    }
                    sb[sb.Length - 1] = ')'; // remove trailing comma

                    info.Label = sb.ToString();
                    //info.ImageIndex = info.GetImageList().Images.IndexOfKey(Resources.DomObjectInterfaceImage);

                    return;
                }
            }