473,224 Members | 1,412 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,224 software developers and data experts.

Very Advanced PropertyGrid control use

Herfried K. Wagner was kind enough to point me to the PropertyGrid control
http://msdn.microsoft.com/library/en...classtopic.asp

I have found a few samples of how to use the PropertyGrid control and have gained a decent understanding of it. But of course, as it usually the case, my needs go far beyond the simple examples shown in online samples. All the online samples show how to take a class with already defined properties and to add metadata attributes. My case is very different.

The basic structure for my classes are:

Class GenericToolObject
Readonly Property IsContainer
Readonly Property Enabled
Readonly Property ShowInToolBox
...few others...
Readonly Property Properties() as ToolObjectProperties

Class ToolObjectProperties
(basically just a collection class of ToolObjectPropertyInfo objects)

Class ToolObjectPropertyInfo
Readonly Property Index
Readonly Property Name
Read/Write Property Value ****
Readonly Property Type (as an enumeration type)
...few others...

Instances of GenericToolObjects and its property definitons are loaded at run-time from XSD files. When an object is edited, the property editor will basically need to display the collection of ToolObjectProperties for the GenericToolObject in the PropertyGrid control, showing the ToolObjectPropertyValue.DisplayName on the left, and the ToolObjectPropertyInfo.Value on the right.

I don't see how adding metadata attributes to my classes will do any good, because the information for property category, descriptions, etc comes from the XSD files which are not loaded until runtime.

Can a PropertyGrid control be controlled to the level I need it such that I can tweak it at run-time to render the property categories, descriptions, etc at run-time without metadata attributes? For an initial prototype I basically created my own property editor which renders labels, textboxes, combobox, checkboxes, datagrids etc to represent the properties for a GenericToolObject instance. The VS.Net PropertyGrid control though is so much nicer and more professional looking. I could indeed update my own property editor to render better and to support property groups and the like, but I am wondering if it would be easier to just use the PropertyGrid control for this purpose.

Any help would be greatly appreciated and of course I will share the solution to this if there is one. I get the feeling that I'm the first to delve into this territory and use of the PropertyGrid control.

Thanks,
Andres

**************************************
Andrés Becerra
Pennsylvania, USA
Email not posted due to email stealing A**H***S that poll newsgroups.
**************************************
Nov 19 '05 #1
1 11811
Jay,

You are a king among men sir. You did indeed point me in the right
direction. After some research into the ICustomTypeDescriptor interface, I
came across this article which gave me a working example to learn from.

http://www.codeproject.com/cs/miscct...=100&tid=40951
1&forumid=13899&select=409511#xx409511xx

Thanks again!!

--
**************************************
Andrés Becerra
Pennsylvania, USA
Email not posted due to email stealing A**H***S that poll newsgroups.
**************************************
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message
news:#n**************@tk2msftngp13.phx.gbl...
Andres,
I do not have a clean example handy.

I believe you need to use the ICustomTypeDescriptor interface. This
interface allows you to dynamically return a list of properties for the
object you are displaying in the Property Grid.

I use ICustomTypeDescriptor to return a list of properties for an object
proxy, which works. For the categories & Descriptions I believe you will
need to override the ICustomTypeDescriptor.GetAttributes method.

My concern is there are one or two other interfaces you need. I use
ICustomTypeDescriptor for some custom data binding to the data grid, I have a proxy object that I just delegate most of the ICustomTypeDescriptor
methods to the actual object. (Via TypeDescriptor)

I took my project and put together a very quick form that uses the property grid and it seems to work, however I do not have attributes, so I'm not sure about that.

Hopefully this enough to get you headed in the right direction! ;-)

Hope this helps
Jay

"ANDRES BECERRA" <a.*******@sap.com> wrote in message
news:be**********@news1.wdf.sap-ag.de...
Herfried K. Wagner was kind enough to point me to the PropertyGrid control
http://msdn.microsoft.com/library/en...windowsformspr
opertygridclasstopic.asp
I have found a few samples of how to use the PropertyGrid control and have
gained a decent understanding of it. But of course, as it usually the case, my needs go far beyond the simple examples shown in online samples. All the online samples show how to take a class with already defined properties and to add metadata attributes. My case is very different.

The basic structure for my classes are:

Class GenericToolObject
Readonly Property IsContainer
Readonly Property Enabled
Readonly Property ShowInToolBox
...few others...
Readonly Property Properties() as ToolObjectProperties

Class ToolObjectProperties
(basically just a collection class of ToolObjectPropertyInfo objects)

Class ToolObjectPropertyInfo
Readonly Property Index
Readonly Property Name
Read/Write Property Value ****
Readonly Property Type (as an enumeration type)
...few others...

Instances of GenericToolObjects and its property definitons are loaded at
run-time from XSD files. When an object is edited, the property editor will basically need to display the collection of ToolObjectProperties for the
GenericToolObject in the PropertyGrid control, showing the
ToolObjectPropertyValue.DisplayName on the left, and the
ToolObjectPropertyInfo.Value on the right.

I don't see how adding metadata attributes to my classes will do any good,
because the information for property category, descriptions, etc comes from the XSD files which are not loaded until runtime.

Can a PropertyGrid control be controlled to the level I need it such that I can tweak it at run-time to render the property categories, descriptions,
etc at run-time without metadata attributes? For an initial prototype I
basically created my own property editor which renders labels, textboxes,
combobox, checkboxes, datagrids etc to represent the properties for a
GenericToolObject instance. The VS.Net PropertyGrid control though is so
much nicer and more professional looking. I could indeed update my own
property editor to render better and to support property groups and the
like, but I am wondering if it would be easier to just use the PropertyGrid control for this purpose.

Any help would be greatly appreciated and of course I will share the
solution to this if there is one. I get the feeling that I'm the first to
delve into this territory and use of the PropertyGrid control.

Thanks,
Andres

**************************************
Andrés Becerra
Pennsylvania, USA
Email not posted due to email stealing A**H***S that poll newsgroups.
**************************************

Nov 19 '05 #2

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

Similar topics

1
by: James Divine | last post by:
Greetings all, I am using a PropertyGrid control in my application and I'm having trouble finding documentation on it. I have my basic PG built and can add Properties of standard types (int,...
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...
0
by: jays | last post by:
Dear Friends, I have been assigned to develop a Custom PropertyGrid with look and fill like the link below http://www.visualhint.com/feature5.php In the PropertyGrid value cells, I am...
0
by: micro_bug | last post by:
Now I am developing a tool, just like VS.net Form Edition environment. User can edit a component's properties by a PropertyGrid control. Now I have some questions about this PropertyGrid control:...
7
by: siddhiash | last post by:
Hi Friends I want to add PasswordChar Property which shows ****** for string which I type in PropertyGrid Control. Regards, Siddharth
4
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...
5
by: Ger | last post by:
The propertygrid is a great control, but I would like to show a more descriptive text for the properties in the control. I tried to find a solution within the system.componentmodel but did not...
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: 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...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.