private void AddChildren(TreeNode parent, IPropertyGridEntity o)
        {
            if (!(o is IPropertyGridEntityParent))
            {
                return;
            }

            var children = (o as IPropertyGridEntityParent).Children;

            for (int i = 0; i < children.Count; i++)
            {
                var child = children[i];

                if (child == null)
                {
                    continue;
                }

                AddNode(parent, i, new TreeNode(child.Name)
                {
                    Name = child.Name, Tag = child, ForeColor = child.Enabled ? Color.Black : Color.Gray
                });

                AddChildren(parent.LastNode, child);
            }
        }
 private void SelectEntityInTreeview(IPropertyGridEntity selectObject)
 {
     foreach (TreeNode node in TreeViewChildren())
     {
         if (node.Tag == selectObject)
         {
             TreeView.SelectedNode = node;
         }
     }
 }
 private void SelectEntityInTreeview(IPropertyGridEntity selectObject)
 {
     foreach (TreeNode node in TreeViewChildren())
         if(node.Tag == selectObject) TreeView.SelectedNode = node;
 }
        private void AddChildren(TreeNode parent, IPropertyGridEntity o)
        {
            if(! (o is IPropertyGridEntityParent)) return;

            var children = (o as IPropertyGridEntityParent).Children;
            for (int i = 0; i < children.Count; i++)
            {
                var child = children[i];

                if (child == null) continue;

                AddNode(parent, i, new TreeNode(child.Name) { Name = child.Name, Tag = child, ForeColor = child.Enabled ? Color.Black : Color.Gray });

                AddChildren(parent.LastNode, child);
            }
        }
 private void ShowSelectedNodeInPropertyGrid()
 {
     SelectedObject = TreeView.SelectedNode != null ? (TreeView.SelectedNode.Tag as IPropertyGridEntity) : null;
 }