Link to home
Start Free TrialLog in
Avatar of Owlguru
Owlguru

asked on

Collection trouble

I have created a custom control, CommandBar, essentially a wrapper for ToolBarWindow32 (the Win32 toolbar control). It has a collection of CommandBarItem objects. Each CommandBarItem is derived from Component. CommandBarItemCollection is derived from CollectionBase. I have also tried ICollection/IList/IEnumerable. Both CommandBar and CommandBarItem have item collections. The item collections in CommandBar and CommandBarItem are marked as DesignerSerializationVisibility.Content. I can add items successfully to the item collection of the CommandBar. I can also add items successfully to the collections of the items in the CommandBar item collection. But when I go to the collections of items of the collections of items of the items in the CommandBar collection and I add a new CommandBarItem with the Collection Editor, I am greeted with "Object reference not set to an instance of an object" when I click OK. Thus, I am forced to click Cancel (the message keeps appearing everytime I click OK), and the items I just added are lost. How can I get the items to persist on infinite depth levels? Do I need an object referring back to the parent collection, like Owner? How did MS do it with the TreeView and Menu controls? I am stuck and I need your help.
Avatar of monkey3
monkey3

can i see a code sample and i may be able to help.
m3
ASKER CERTIFIED SOLUTION
Avatar of Ceiled
Ceiled
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well, since the administrative updates brought this question back to my attention, I may as well point out that the issue appears to be fixed in the Whidbey beta.