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

PropertyGrid and object fields

Hello,
I'm using a PropertyGrid on my form in lieu of a big ugly dialog box, or
rather several large dialogs, so the user can manipulate some objects. I've
got a font field that displays with a nice little drop down feature showing
the font properties slightly indented from the other properties. In the .Net
editor, this works for quite a few fields such as Size, and DataBindings.
How can I get one of my own classes, which exists as a field in other
classes to behave the same way in the property grid?

In other words, I've got a read/write field which exposes another object in
the class that I set as the PropertyGrid's SelectedObject, but all I get in
the PropertyGrid is a string showing the type of the field.

Hope I've made myself clear.

Eric Eggermann
Nov 15 '05 #1
2 6736
You have to implement a "TypeConverter" for your object. In the type
converter class, you have to override "GetProperties" method and construct a
"PropertyDescriptor" collection and return it. This will make the Property
grid work the way you want it.

(look up on the words in quote in MSDN - there's plenty of documentation to
help u along the way)

VJ
"Eric Eggermann >" <<none> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
Hello,
I'm using a PropertyGrid on my form in lieu of a big ugly dialog box, or
rather several large dialogs, so the user can manipulate some objects. I've got a font field that displays with a nice little drop down feature showing the font properties slightly indented from the other properties. In the ..Net editor, this works for quite a few fields such as Size, and DataBindings.
How can I get one of my own classes, which exists as a field in other
classes to behave the same way in the property grid?

In other words, I've got a read/write field which exposes another object in the class that I set as the PropertyGrid's SelectedObject, but all I get in the PropertyGrid is a string showing the type of the field.

Hope I've made myself clear.

Eric Eggermann

Nov 15 '05 #2

"Vijaye Raji" <no************@hotmail.com> wrote in message
news:H8********************@comcast.com...
You have to implement a "TypeConverter" for your object. In the type
converter class, you have to override "GetProperties" method and construct a "PropertyDescriptor" collection and return it. This will make the Property grid work the way you want it.

(look up on the words in quote in MSDN - there's plenty of documentation to help u along the way)


Thanks very much Vijaye. Your search terms brought me to the answer. In my
case, I didn't actually have to implement anything. I just needed to set the
following attribute,
[TypeConverter(typeof(System.ComponentModel.Expanda bleObjectConverter))]

to the properties exposing my object.

It's easy when you know how, huh.

Eric Eggermann
Nov 15 '05 #3

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

Similar topics

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...
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
0
by: Job Lot | last post by:
I am using a third party object that exposes public fields instead of public properties. How can I bind these public fields to a PropertyGrid so that user can change the values at run time using...
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...
0
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...
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...
3
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,...
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: 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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.