473,666 Members | 2,167 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 3838
...oh. and I can't use a 3rd part tool. I must work off of the native
property grid.

"Ron M. Newman" <co**********@c onfideltial.com wrote in message
news:e2******** ******@TK2MSFTN GP04.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
ICustomTypeDesc riptor interface? or is there another way?

Thanks
Ron

"Jon Shemitz" <jo*@midnightbe ach.comwrote in message
news:45******** *******@midnigh tbeach.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
ICustomTypeDesc riptor 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, ICustomTypeDesc riptor or you can create a TypeConverter for your class.
Each can be used to create a PropertyDescrip torCollection which contains all
of the properties to be used by the PropertyGrid.

You can create PropertyDescrip tors that don't have any true property backing
by deriving a class from TypeConverter.S implePropertyDe scriptor (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 PropertyDescrip tor.

--
Dave Sexton

"Ron M. Newman" <co**********@c onfideltial.com wrote in message
news:%2******** ********@TK2MSF TNGP04.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
ICustomTypeDesc riptor interface? or is there another way?

Thanks
Ron

"Jon Shemitz" <jo*@midnightbe ach.comwrote in message
news:45******** *******@midnigh tbeach.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**********@c onfideltial.com wrote in message
news:e2******** ******@TK2MSFTN GP04.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 TypeDescription Provider 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**********@c onfideltial.com wrote in message
news:e2******** ******@TK2MSFTN GP04.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
2892
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 with a single PropertyGrid control on each tab that fills it's parent's tab page's client area. Here's what I did. 1. Create a new project.
3
6042
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 from a database and manipulate the TypeConverters dynamically. The property grid then displays the property with a drop down list. It does work when I open the application for the first time. If, however, I open the form and then open a second...
1
2569
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 the SelectedObject's properties outside of the PropertyGrid. If I use the PropertyGrid to change the SelectedObject's properties then everything works as expected (even when one property causes another property to change, etc.). But, if I...
4
3070
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 selectedobject will be the form itself. I want the user to change certain properties, thus changing the form. This works fine, but what I really want is to take the changes and lock them into a config file, such that this pc will then display all...
4
2210
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 items to be edited in the Collection Editor (by clicking the button with the ellipses). But, for properties of type Array a PropertyGrid also allows array elements to be edited directly by expanding the array within the PropertyGrid. The problem...
0
1527
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 expand the property) and allow those values to be edited. My code is below. The grid is showing the values but they are read-only, although the other properties for the rest of my class are editable. Public Class MeshConverter
5
3010
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. Some of the inputs can be either monetary or percantage. The ideal scenario is where the user enters the value and immediately to the right of the value field is a drop down, defaulted to %,which allows a currency to be selected.
4
18817
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 it seems to me that a PropertyGrid is a perfect modern replacement. I won't bore you with the details with all the controls on the dialog since I'm only concerned with one issue. The legacy dialog contains a drop down list control that is...
3
4349
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, Steve
0
8449
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8876
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8556
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8642
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7387
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4198
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4371
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2774
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 we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.