private void PreparePropertyGridForPathTreeNode(PropertyGridEx.PropertyGridEx pgex, ShapeObject so) { List<PathTreeNode> ptn_list = new List<PathTreeNode>(); PathTreeNode dummy = new PathTreeNode(); dummy.Text = "No path"; dummy.PathObject = null; ptn_list.Add(dummy); foreach (TreeNode tn in avstn.Nodes) { if(tn.GetType() == typeof(PathTreeNode)) { PathTreeNode ptn = (PathTreeNode)tn; ptn_list.Add(ptn); } } ArrayList ary = new ArrayList(ptn_list); int v = 0; if (so.GetPathTreeNode().PathIndex != v) { v = so.GetPathTreeNode().PathIndex; } pgex.Item.Add("Path", ary[v], false, "Path", "Path of the shape", true); pgex.Item[pgex.Item.Count - 1].Choices = new PropertyGridEx.CustomChoices(ary); }