Index: Core/Common/src/Core.Common.Controls.TreeView/TreeNodeInfo.cs =================================================================== diff -u -rfd98bcf5d1811dbcad2cc0e292a4349f8402b83a -r27da41d332f4ab3c36223ead8f39e9fae6621711 --- Core/Common/src/Core.Common.Controls.TreeView/TreeNodeInfo.cs (.../TreeNodeInfo.cs) (revision fd98bcf5d1811dbcad2cc0e292a4349f8402b83a) +++ Core/Common/src/Core.Common.Controls.TreeView/TreeNodeInfo.cs (.../TreeNodeInfo.cs) (revision 27da41d332f4ab3c36223ead8f39e9fae6621711) @@ -69,6 +69,12 @@ public Func EnsureVisibleOnCreate { get; set; } /// + /// Gets or sets a function for determining whether or not the tree node should be expanded on creation. + /// The object parameter represents the data of the tree node. + /// + public Func ExpandOnCreate { get; set; } + + /// /// Gets or sets a function for obtaining child node objects. /// The object parameter represents the data of the tree node. /// @@ -207,6 +213,12 @@ public Func EnsureVisibleOnCreate { get; set; } /// + /// Gets or sets a function for determining whether or not the tree node should be expanded on creation. + /// The parameter represents the data of the tree node. + /// + public Func ExpandOnCreate { get; set; } + + /// /// Gets or sets a function for obtaining child node objects. /// The parameter represents the data of the tree node. /// @@ -318,6 +330,9 @@ EnsureVisibleOnCreate = treeNodeInfo.EnsureVisibleOnCreate != null ? (tag, parentTag) => treeNodeInfo.EnsureVisibleOnCreate((TData) tag, parentTag) : (Func) null, + ExpandOnCreate = treeNodeInfo.ExpandOnCreate != null + ? tag => treeNodeInfo.ExpandOnCreate((TData) tag) + : (Func) null, ChildNodeObjects = treeNodeInfo.ChildNodeObjects != null ? tag => treeNodeInfo.ChildNodeObjects((TData) tag) : (Func) null, Index: Core/Common/test/Core.Common.Controls.TreeView.Test/TreeNodeInfoTest.cs =================================================================== diff -u -rff8a088931e6af2e46f6f4f09b633bcdd0b84ecd -r27da41d332f4ab3c36223ead8f39e9fae6621711 --- Core/Common/test/Core.Common.Controls.TreeView.Test/TreeNodeInfoTest.cs (.../TreeNodeInfoTest.cs) (revision ff8a088931e6af2e46f6f4f09b633bcdd0b84ecd) +++ Core/Common/test/Core.Common.Controls.TreeView.Test/TreeNodeInfoTest.cs (.../TreeNodeInfoTest.cs) (revision 27da41d332f4ab3c36223ead8f39e9fae6621711) @@ -42,6 +42,7 @@ Assert.IsNull(treeNodeInfo.Image); Assert.IsNull(treeNodeInfo.ContextMenuStrip); Assert.IsNull(treeNodeInfo.EnsureVisibleOnCreate); + Assert.IsNull(treeNodeInfo.ExpandOnCreate); Assert.IsNull(treeNodeInfo.ChildNodeObjects); Assert.IsNull(treeNodeInfo.CanRename); Assert.IsNull(treeNodeInfo.OnNodeRenamed); @@ -67,6 +68,7 @@ Func image = o => new Bitmap(16, 16); Func contextMenuStrip = (o1, o2, tvc) => new ContextMenuStrip(); Func ensureVisibleOnCreate = (o, p) => true; + Func expandOnCreate = o => true; Func childNodeObjects = o => new object[0]; Func canRename = (o1, o2) => true; Action onNodeRenamed = (o, newName) => { }; @@ -87,6 +89,7 @@ treeNodeInfo.Image = image; treeNodeInfo.ContextMenuStrip = contextMenuStrip; treeNodeInfo.EnsureVisibleOnCreate = ensureVisibleOnCreate; + treeNodeInfo.ExpandOnCreate = expandOnCreate; treeNodeInfo.ChildNodeObjects = childNodeObjects; treeNodeInfo.CanRename = canRename; treeNodeInfo.OnNodeRenamed = onNodeRenamed; @@ -107,6 +110,7 @@ Assert.AreEqual(image, treeNodeInfo.Image); Assert.AreEqual(contextMenuStrip, treeNodeInfo.ContextMenuStrip); Assert.AreEqual(ensureVisibleOnCreate, treeNodeInfo.EnsureVisibleOnCreate); + Assert.AreEqual(expandOnCreate, treeNodeInfo.ExpandOnCreate); Assert.AreEqual(childNodeObjects, treeNodeInfo.ChildNodeObjects); Assert.AreEqual(canRename, treeNodeInfo.CanRename); Assert.AreEqual(onNodeRenamed, treeNodeInfo.OnNodeRenamed); @@ -134,6 +138,7 @@ Assert.IsNull(treeNodeInfo.Image); Assert.IsNull(treeNodeInfo.ContextMenuStrip); Assert.IsNull(treeNodeInfo.EnsureVisibleOnCreate); + Assert.IsNull(treeNodeInfo.ExpandOnCreate); Assert.IsNull(treeNodeInfo.ChildNodeObjects); Assert.IsNull(treeNodeInfo.CanRename); Assert.IsNull(treeNodeInfo.OnNodeRenamed); @@ -158,6 +163,7 @@ Func image = o => new Bitmap(16, 16); Func contextMenuStrip = (o1, o2, tvc) => new ContextMenuStrip(); Func ensureVisibleOnCreate = (o, p) => true; + Func expandOnCreate = o => true; Func childNodeObjects = o => new object[0]; Func canRename = (o1, o2) => true; Action onNodeRenamed = (o, newName) => { }; @@ -177,6 +183,7 @@ treeNodeInfo.Image = image; treeNodeInfo.ContextMenuStrip = contextMenuStrip; treeNodeInfo.EnsureVisibleOnCreate = ensureVisibleOnCreate; + treeNodeInfo.ExpandOnCreate = expandOnCreate; treeNodeInfo.ChildNodeObjects = childNodeObjects; treeNodeInfo.CanRename = canRename; treeNodeInfo.OnNodeRenamed = onNodeRenamed; @@ -197,6 +204,7 @@ Assert.AreEqual(image, treeNodeInfo.Image); Assert.AreEqual(contextMenuStrip, treeNodeInfo.ContextMenuStrip); Assert.AreEqual(ensureVisibleOnCreate, treeNodeInfo.EnsureVisibleOnCreate); + Assert.AreEqual(expandOnCreate, treeNodeInfo.ExpandOnCreate); Assert.AreEqual(childNodeObjects, treeNodeInfo.ChildNodeObjects); Assert.AreEqual(canRename, treeNodeInfo.CanRename); Assert.AreEqual(onNodeRenamed, treeNodeInfo.OnNodeRenamed); @@ -229,6 +237,7 @@ Assert.IsNull(treeNodeInfo.Image); Assert.IsNull(treeNodeInfo.ContextMenuStrip); Assert.IsNull(treeNodeInfo.EnsureVisibleOnCreate); + Assert.IsNull(treeNodeInfo.ExpandOnCreate); Assert.IsNull(treeNodeInfo.ChildNodeObjects); Assert.IsNull(treeNodeInfo.CanRename); Assert.IsNull(treeNodeInfo.OnNodeRenamed); @@ -265,6 +274,7 @@ } }, EnsureVisibleOnCreate = (o, p) => true, + ExpandOnCreate = o => true, ChildNodeObjects = o => new[] { new object() @@ -302,6 +312,7 @@ Assert.AreEqual(Color.Azure, treeNodeInfo.ForeColor(0)); Assert.AreEqual(16, treeNodeInfo.Image(0).Height); Assert.IsTrue(treeNodeInfo.EnsureVisibleOnCreate(0, 1)); + Assert.IsTrue(treeNodeInfo.ExpandOnCreate(0)); Assert.AreEqual(1, treeNodeInfo.ChildNodeObjects(0).Length); Assert.IsTrue(treeNodeInfo.CanRename(0, 1)); Assert.IsTrue(treeNodeInfo.CanRemove(0, 1));