Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / April 2006

Tip: Looking for answers? Try searching our database.

Properties with subproperties in propertygrid?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kingherc - 28 Mar 2006 08:09 GMT
Hi to all,

In a .net 2.0 program, I'm trying to use the property grid. When the
property grid displays an object, it successfully displays its properties.
What I'd like to ask is: How can I make a property to have "sub-properties"
on the propertygrid? Something like (Application Settings) that is displayed
when WindowsForm Controls are selected or something like Font which has
subproperties ('size', 'face', 'color' etc.).

Thanks for any help!
Stoitcho Goutsev (100) - 28 Mar 2006 15:05 GMT
Kingherc,

The easiest way is to attribute the type or property with
ExpandableObjectConverter.
Normally you create your own conveter that derives from this type.

[TypeConverter(MyTypeExpandableConverter)]
MyType Prop
{
....
}

Normally in the converter class you need to override couple of methods in
order to convert from/to string.

Signature

HTH
Stoitcho Goutsev (100)

> Hi to all,
>
[quoted text clipped - 8 lines]
>
> Thanks for any help!
Torbjørn - 04 Apr 2006 07:38 GMT
Hi,

I tried doing the same thing for displaying a custom class derived from
ApplicationSettingsBase (called EngineSettings). EngineSettings again
contained another class derived from ApplicationSettingsBase (called
GroupSettings).

By using the default ExpandableObjectConverter for the GroupSettings class I
have been unable to expand the GroupSettings property of EngineSettings when
displayed in a propertygrid.

If EngineSettings does not inherit from ApplicationSettingsBase, the
GroupSettings property DOES expand, but not when it inherits from it.

Does my GroupSettings class HAVE to have a custom TypeConverter? Is it not
possible to use the ExpandableObjectConverter?

Thanks!

-Torbjørn

> Kingherc,
>
[quoted text clipped - 23 lines]
> >
> > Thanks for any help!
Torbjørn - 04 Apr 2006 08:19 GMT
Hi again,

I finally figured out my problem: I had forgotten to do "new" on my custom
settings, since (of course) ApplicationSettingsBase does not do that for you.

Cheers,
Torbjørn

> Hi,
>
[quoted text clipped - 44 lines]
> > >
> > > Thanks for any help!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.