Re: Custom Collection in Property Grid

From: Bob Powell [MVP] (bob_at__spamkiller_bobpowell.net)
Date: 12/08/04


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


Relevant Pages

  • Re: file() works in Windows not on Linux
    ... The file I am reading from is not under my control. ... have no problems running this in Windows, but it blows up in Linux. ...
    (php.general)
  • Custom Collection in Property Grid
    ... I have a menu control I am writing, and I have created a "MenuItem" ... which extends CollectionBase. ... I have been reading some about using PropertyDescriptors to tell the ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: "Not Responding" when reading and processing large file
    ... it hungs because the window proc of your appl does not process messages sent ... to fix that create thread which will be reading your large file and make ... I advice you to read Richter's "advanced windows" and you will understand ... I lose control of the form. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: older games dont work
    ... the support of my work have it and will burn a CD to me. ... and any other tips to make this game works will be great. ... Windows 95 including but not limited to: ... to map a pedal as a control ...
    (microsoft.public.windowsxp.games)
  • Re: Listing of XP tools commands
    ... All files with a .cpl extension are normally invoked via the Control ... IP Configuration - ipconfi/all ... Logs You Out Of Windows - logoff... ... System File Checker Utility - sfc /revert ...
    (microsoft.public.windowsxp.general)