Re: Custom Collection in Property Grid
From: Bob Powell [MVP] (bob_at__spamkiller_bobpowell.net)
Date: 12/08/04
- Next message: Bob Powell [MVP]: "Re: How can I play movies in VB.Net"
- Previous message: Jeffrey Tan[MSFT]: "Re: Placing a .NET UserControl in a COM type "Wrapper""
- In reply to: John Parrish: "Custom Collection in Property Grid"
- Next in thread: John Parrish: "Re: Custom Collection in Property Grid"
- Reply: John Parrish: "Re: Custom Collection in Property Grid"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 8 Dec 2004 11:00:02 +0100
Your collection should have an indexer. I suspect that it doesn't. I usually
write an Add, Remove and an idexer and that seems to work fine.
The objects that you store should be marked as Serializable.
The property that provides the collection should ideally be read-only and be
marked with the DesigerSerializationVisibility attribute using
DesignerSerializationVisibility.Content This will enable the codegenerator
to serialize your ojects.
See Windows Forms Tips and Tricks for an article on how to debug controls at
design time too.
-- Bob Powell [MVP] Visual C#, System.Drawing Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm All new articles provide code in C# and VB.NET. Subscribe to the RSS feeds provided and never miss a new article. "John Parrish" <pleaseask@me.com> wrote in message news:%23ljw7$J3EHA.1300@TK2MSFTNGP14.phx.gbl... > I have a menu control I am writing, and I have created a "MenuItem" > class and also a strongly typed collection "MenuItemCollection" class > which extends CollectionBase. > > When I add a property to my control of type MenuItemCollection, the > property grid can see that it is a collection but the collection editor > that opens is for type "Object" and doesn't allow me to set the > properties of my MenuItem members. > > I have been reading some about using PropertyDescriptors to tell the > propertygrid what type of item is in my collection, but I have done a > lot of reading/coding and am just getting frustrated. Any advice is > appreciated. Thanks > > John P
- Next message: Bob Powell [MVP]: "Re: How can I play movies in VB.Net"
- Previous message: Jeffrey Tan[MSFT]: "Re: Placing a .NET UserControl in a COM type "Wrapper""
- In reply to: John Parrish: "Custom Collection in Property Grid"
- Next in thread: John Parrish: "Re: Custom Collection in Property Grid"
- Reply: John Parrish: "Re: Custom Collection in Property Grid"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|