Hi
Should I be able to use a simple Collection in a PropertyGrid, without all the code described in Gerd Klevesaat's article on Code Project?
http://www.codeproject.com/KB/tabs/customizingcollectiondata.aspx?fid=16073&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=1#xx0xx
I have used a PropertyGrid to display an instance and it appears to work but ....
What I have is:
- Class Foo, with three String Properties, and one Boolean ReadOnly Property
- Class FooCollection which inherits Collections.Generic.List(Of Foo)
(That's all, there is noother Code in FooCollection)
- Class FooBar, which has
Property Title as string
Property Foos as FooCollection
- In my Form the PropertyGrid.SelectedObject is an instance of FooBar
- I have used some of the ComponentModel Attribute tags (like CategoryAttribute) as described in Gerd's earlier article
http://www.codeproject.com/KB/vb/using_propertygrid.aspx
What happens is:
- The FooBar PropertyGrid shows OK, I see Title and Foos properties
- If I change the Title value it is updated in the FooBar instance
- I see theFoos property and click on the Colection Editoor button
- The Collection Editor dialogue shows
- Click on the Add button and an instance of Foo is added (in the left panel)
- I see all the Foo properties on the Right panel and can change them. Values are returned to the Foo instance.
- I can continue adding new Foo instances to the collection.
When I click OK on the Collection Editor the FooCollection is NOT returned to the Foos Property. If I click on the Collection Editor button in Foos again, the Collection Editor is empty.
Do I have to do all the customisation described in Gerd's article in order to get this simple Collection to work in the PropertyGrid, or is there something simpler that I've missed?
VS 2008, .NET 3.5, VB
Thanks
Steve