|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to serialize a custom collection at design timeWhen you do, it serializes the TreeNode's in the InitializeComponent procedure using the AddRange method on the TreeNodeCollection class. E.g. this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { new System.Windows.Forms.TreeNode("Node0"), new System.Windows.Forms.TreeNode("Node1"), new System.Windows.Forms.TreeNode("Node2"), new System.Windows.Forms.TreeNode("Node3"), new System.Windows.Forms.TreeNode("Node4")}); I'm currently writing a custom control, that also has a custom collection that you can add and remove items to add design time. I've added a AddRange method to the custom collection, but I can't work out how to serialize the collection (like the TreeNodeCollection class) so that it uses the AddRange method (like in the above example). Can someone please show me how to serialize a custom collection into the InitializeComponent procedure so that it uses the AddRange (like in the above example)? Thank you Regards Mark You might find some help at my post:
9/21/2005 XmlSerialization with IDictionary and CollectionBase Objects http://sholliday.spaces.live.com/blog/ Show quoteHide quote "Mark Collard" <Mark Coll***@discussions.microsoft.com> wrote in message news:305F6501-CCCB-4071-A9C6-CE55AB38180B@microsoft.com... > I've noticed that you can add TreeNode's to a TreeView control at design. > When you do, it serializes the TreeNode's in the InitializeComponent > procedure using the AddRange method on the TreeNodeCollection class. > > E.g. > > this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { > new System.Windows.Forms.TreeNode("Node0"), > new System.Windows.Forms.TreeNode("Node1"), > new System.Windows.Forms.TreeNode("Node2"), > new System.Windows.Forms.TreeNode("Node3"), > new System.Windows.Forms.TreeNode("Node4")}); > > > I'm currently writing a custom control, that also has a custom collection > that you can add and remove items to add design time. I've added a AddRange > method to the custom collection, but I can't work out how to serialize the > collection (like the TreeNodeCollection class) so that it uses the AddRange > method (like in the above example). > > Can someone please show me how to serialize a custom collection into the > InitializeComponent procedure so that it uses the AddRange (like in the above > example)? > > Thank you > > Regards > Mark
Other interesting topics
Interlocked.Increment bug?
ANN: VS2005 SP1 How to convert .xls file into text file. Debug Settings VS2005 - "Break on All Errors" Left or Right Tab Alignment missing text How to get the color of the specified pixel in the screen? Programmaticaly checking a shortcuts properties? Sending StandardInput.WriteLine to a C++ Console Application PropertyGrid - how to display a string array as dropdown property KeyedCollection serialization with SoapFormatter |
|||||||||||||||||||||||