473,508 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

More PropertyGrid Agony

Hi,

Can the native PropertyGrid accept dynamic properties? ones that are not
pre-compiled into a class and don't have those [TAGS] thingies attached to
properties? Can I just instantiate a property grid and put a dynamic "Name"
property in there without having a class with a name property "fed" to it?

Thanks
Ron
Nov 16 '06 #1
7 3832
...oh. and I can't use a 3rd part tool. I must work off of the native
property grid.

"Ron M. Newman" <co**********@confideltial.comwrote in message
news:e2**************@TK2MSFTNGP04.phx.gbl...
Hi,

Can the native PropertyGrid accept dynamic properties? ones that are not
pre-compiled into a class and don't have those [TAGS] thingies attached to
properties? Can I just instantiate a property grid and put a dynamic
"Name" property in there without having a class with a name property "fed"
to it?

Thanks
Ron


Nov 16 '06 #2
Can the native PropertyGrid accept dynamic properties? ones that are not
pre-compiled into a class and don't have those [TAGS] thingies attached to
properties? Can I just instantiate a property grid and put a dynamic "Name"
property in there without having a class with a name property "fed" to it?
Yes. The API is complex, but you can create 'virtual' properties; set
arbitrary display text; enable and disble; hide and show.

--

www.midnightbeach.com/.net
..NET, from the outside to the inside.
Nov 16 '06 #3
Hi,
Yes. The API is complex, but you can create 'virtual' properties; set
arbitrary display text; enable and disble; hide and show.
How? any hints? is it by "simulating" properties using the
ICustomTypeDescriptor interface? or is there another way?

Thanks
Ron

"Jon Shemitz" <jo*@midnightbeach.comwrote in message
news:45***************@midnightbeach.com...
>Can the native PropertyGrid accept dynamic properties? ones that are not
pre-compiled into a class and don't have those [TAGS] thingies attached
to
properties? Can I just instantiate a property grid and put a dynamic
"Name"
property in there without having a class with a name property "fed" to
it?

Yes. The API is complex, but you can create 'virtual' properties; set
arbitrary display text; enable and disble; hide and show.

--

www.midnightbeach.com/.net
.NET, from the outside to the inside.

Nov 16 '06 #4
"Ron M. Newman" wrote:
How? any hints? is it by "simulating" properties using the
ICustomTypeDescriptor interface? or is there another way?
It's been a couple years, so my hint is www.google.com. As I recall,
there was a "property bag" project that didn't have any code we could
actually use, but which pointed in the right direction.

If you're really clueless, I could look at my old code and post some
more tips, but I can't post the old code because I don't own it.

--

www.midnightbeach.com/.net
..NET, from the outside to the inside.
Nov 17 '06 #5
Hi Ron,

Yes, ICustomTypeDescriptor or you can create a TypeConverter for your class.
Each can be used to create a PropertyDescriptorCollection which contains all
of the properties to be used by the PropertyGrid.

You can create PropertyDescriptors that don't have any true property backing
by deriving a class from TypeConverter.SimplePropertyDescriptor (nested,
protected abstract class. You can derive a class that is nested in another
custom class that must derive from TypeConverter). If you don't need a custom
TypeConverter or if you just want a "cleaner" method of creating custom
property descriptors, just derive a class from PropertyDescriptor.

--
Dave Sexton

"Ron M. Newman" <co**********@confideltial.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Hi,
>Yes. The API is complex, but you can create 'virtual' properties; set
arbitrary display text; enable and disble; hide and show.

How? any hints? is it by "simulating" properties using the
ICustomTypeDescriptor interface? or is there another way?

Thanks
Ron

"Jon Shemitz" <jo*@midnightbeach.comwrote in message
news:45***************@midnightbeach.com...
>>Can the native PropertyGrid accept dynamic properties? ones that are not
pre-compiled into a class and don't have those [TAGS] thingies attached to
properties? Can I just instantiate a property grid and put a dynamic
"Name"
property in there without having a class with a name property "fed" to it?

Yes. The API is complex, but you can create 'virtual' properties; set
arbitrary display text; enable and disble; hide and show.

--

www.midnightbeach.com/.net
.NET, from the outside to the inside.


Nov 17 '06 #6
Hi Ron,
pre-compiled into a class and don't have those [TAGS] thingies
Those "[TAGS] thingies" you are referring to are called Attributes. You can
create custom Attributes as well by deriving from the Attribute class to
associate custom meta-data to your classes, structures, enums, their various
members, method arguments, return values, etc.

Attributes are extremely important in managed code, so I suggested that you
research them ASAP and make sure that you understand them.

Even if you don't create your own they are used frequently in the FCL for
various reasons such as CAS, support for the compiler, COM-interop, debugging,
data-binding, serialization, custom meta-data, to supply information about
properties to the PropertyGrid, etc.

--
Dave Sexton

"Ron M. Newman" <co**********@confideltial.comwrote in message
news:e2**************@TK2MSFTNGP04.phx.gbl...
Hi,

Can the native PropertyGrid accept dynamic properties? ones that are not
pre-compiled into a class and don't have those [TAGS] thingies attached to
properties? Can I just instantiate a property grid and put a dynamic "Name"
property in there without having a class with a name property "fed" to it?

Thanks
Ron


Nov 17 '06 #7
PropertyGrid will display any properties you hand to it.

Changes to the .NET 2.0 system have greatly increased the usefulness of the
TypeDescriptor. You should check out the TypeDescriptionProvider system.

Essentially you can expose properties, filter them, change them even add
totally artificial ones and the PropertyGrid will enable you to edit them.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

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.

"Ron M. Newman" <co**********@confideltial.comwrote in message
news:e2**************@TK2MSFTNGP04.phx.gbl...
Hi,

Can the native PropertyGrid accept dynamic properties? ones that are not
pre-compiled into a class and don't have those [TAGS] thingies attached to
properties? Can I just instantiate a property grid and put a dynamic
"Name" property in there without having a class with a name property "fed"
to it?

Thanks
Ron


Nov 26 '06 #8

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

Similar topics

6
2882
by: Terry | last post by:
I have a very basic program, but for some reason I can't get it to behave properly. What I want is a basic form with a TabControl that fills the entire form. The tab control should have 4 tabs...
3
6037
by: Dave Girvitz | last post by:
I have a PropertyGrid (Windows Forms App) based component that uses TypeConverters to generate ranges of acceptable values for properties. The idea was that I could download the key/value pairs...
1
2555
by: Lance | last post by:
Is there any way to tell a Windows.Forms.PropertyGrid to update the values for the properties that it is displaying? I am having trouble getting the PropertyGrid to update when I make changes to...
4
3063
by: Bernie Yaeger | last post by:
How can I set the browsableattributes of the control that has been selected (selectedobject) by the propertygrid? Here's what I'm after - I want to open a form with a propertygrid in it. The...
4
2203
by: ljlevend | last post by:
Is there any way to prevent a PropertyGrid from allowing the user to expand the elements of an array? For properties that are of type ArrayList or CollectionBase a PropertyGrid only allows the...
0
1519
by: movieknight | last post by:
Hi, I have a class which I am feeding to the propertygrid, and I am exposing a Mesh object from my class for the propertygrid to display. I want the propertygrid to show the values (when you...
5
3000
by: Lee | last post by:
Hi, Using the propertygrid, is it possible to have a user selectable 'unit of measure' for a field. For example, I am looking at using a propertygrid for defining inputs into a calculation. ...
4
18805
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...
3
4324
by: =?Utf-8?B?U3RldmVU?= | last post by:
Is it possible to hide a row within a PropertyGrid based upon the boolean value of another row within the PropertyGrid? I am using VS2005 with .NET Frameworks 2.0. -- ----------- Thanks,...
0
7132
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7401
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7063
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5640
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
432
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.