|
-
Jan 28th, 2010, 04:38 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Designer, List inside List, drops data
Hi All,
This is a fairly circumstantial question, so I'm not sure if anyone will be able to help, but maybe someone has come across this before.
Well I have a custom user control that has a property that is a List of objects, that object type also has a List inside of it. When I use this control at design time, I can use the designer to create items in the main list, and all the items and their properties stay set just as you'd expect, but the list property inside of those items (so the sublist) drops data (I mean, I can open a designer for these sublists and add items just fine.. but when I save the list is simply lost).
I looked into some code for creating a collection class for the main list in hope that this would help (as opposed to just List<type>) but all the examples seem to be old code I presume because we now have generics to do this (which normally works fine until this strange little quirk).
So hopefully you understood all that and have some suggestions 
Code in question of a user control
Code:
[Serializable]
public struct ToolboxGroup
{
public string Name { get; set; }
public List<ToolboxItem> Items { get; set; }
}
[Serializable]
public struct ToolboxItem
{
public string DisplayName { get; set; }
public string Name { get; set; }
public Image Icon { get; set; }
}
public List<ToolboxGroup> items = new List<ToolboxGroup>();
public List<ToolboxGroup> Groups { get { return items; } set { items = value; } }
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|