473,324 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

PropertyGrid and the base classes

Is there a way to pass a class to the SelectedObject of PropertyGrid and have
it only show the properties in the child class and not those in the base
class's that it is derived from?

Thanks.

--
John Olbert

Jul 20 '07 #1
2 1918
I don't know of any way. You can control the behaviour of individual
properties in the grid via the Browsable and ReadOnly attributes in the
System.ComponentModel namespace. I've always used a dedicated class as the
SelectedObject recipient. The dedicated class would contain a reference to
your derived class instance. It exposes properties equivalent to just those
on your derived class that you want to expose via the property grid. You can
then decorate the properties on the dedicated class with attributes to
control the behaviour of the grid. A good example of this would be when you
want a custom editor to be used for a property when its displayed in the grid.

This pattern is similar to how Microsoft does things in the Enterprise
Library configuration tool. Briefly, they have hierarchies of classes
derived from System.Configuration.ConfigurationElement. Each one does not
get exposed in a property grid directly. Instead it has an equivalent
ConfigurationNode-derived class exposing just the properties that are to be
visible in the grid.

Hope this helps.

David Razzetti

"John Olbert" wrote:
Is there a way to pass a class to the SelectedObject of PropertyGrid and have
it only show the properties in the child class and not those in the base
class's that it is derived from?

Thanks.

--
John Olbert
Jul 20 '07 #2
John,

I would create a wrapper type which would implement
ICustomTypeDescriptor. The implementation would take the object you are
looking to display in the property grid. Then, using reflection, you would
pass back the properties, attributes, etc, etc, etc, which should be
displayed (a determination you would make through reflection, no doubt).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"John Olbert" <so*****@snet.netwrote in message
news:6D**********************************@microsof t.com...
Is there a way to pass a class to the SelectedObject of PropertyGrid and
have
it only show the properties in the child class and not those in the base
class's that it is derived from?

Thanks.

--
John Olbert

Jul 20 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Chris Dunaway | last post by:
When using a PropertyGrid, I have an object with a Date property, but I am only interested in the Time portion. How do I make the PropertyGrid allow editing the time only? Just the hours and...
1
by: Terry | last post by:
I created a collection derived from CollectionBase that is just made up of strings, called "StringList". I have another object that has as a member one of these StringList. If I assign that...
2
by: Mevar81 | last post by:
Hi to everybody.I have a problem with the PropertyGrid control.I want to display not all the properties of a generic Control(Button,TextBox,ComboBox,ecc.).In general I don't want to display only...
1
by: ANDRES BECERRA | last post by:
Herfried K. Wagner was kind enough to point me to the PropertyGrid control http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwindowsformspropertygridclasstopic.asp I have found a few...
0
by: hammad.awan_nospam | last post by:
Hello, I have used SqlMetal to generate the Dlinq classes for my database schema. I have created instances of those classes and then tried binding them to a PropertyGrid object through it's...
6
by: Steve Teeples | last post by:
Can someone show me an example of how to place a "CheckedListBox" property within a PropertyGrid? -- ----------- Thanks, Steve
4
by: Tugrul HELVACI | last post by:
Changing DisplayNames of my properties using PropertyGrid component, how ?? I'm using Delphi 2006 and I have a class defination like this: TPerson = class fPersonName : String;...
4
by: phcmi | last post by:
I have a PropertyGrid question. My task is to replace a legacy dialog box presentation with a modern one. The dialog itself allows the user to set configuration settings in our application, so...
8
by: colin | last post by:
Hi, I thought I could use the property grid to nicly edit some of my data, however it seems to require each field to be a property, wich I didnt realise was implied in the name of it lol. Is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.