473,398 Members | 2,125 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,398 software developers and data experts.

TypeConverter for a PropertyGrid

PropertyDescriptor Class has a Converter method, which if overriden,
would return a TypeConverter.

I was working on dynamic values for a propertygrid, so for each
property all the methods of the PropertyDescriptor class were
overridden. But for a dropdown list I needed the COnverter method
also, but I dont know how I would do it?

eg.

public override Type PropertyType
{
get { return Type.GetType(item.TypeName); }
}

returns a Type.

public override TypeConverter Converter
{
get
{
return ?
}

}

Please help. Any help will be appreciated.

Thanx

Jul 18 '07 #1
1 2156
If you want the default converter for the type, then:
TypeDescriptor.GetConverter(PropertyType)...

However! Note that you don't need to override this; the default
implementation will do the above as the default, but will also
correctly support TypeConverterAttribute if specified for the
property. As a general rule, you don't need to provide all the
functionality yourself...

Marc
Jul 19 '07 #2

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

Similar topics

0
by: Paul Talbot | last post by:
Hi, I'm after help using reflection with the propertygrid. I am creating a dynamic class and putting it into a propertygrid. For simple textboxes, static content dropdowns and datetime...
5
by: ljlevend | last post by:
Is there a TypeConverter that converts Doubles to percent values in a PropertyGrid? The Windows.Forms.Form.Opacity property seems to use the TypeConverter that I want. Thank you, Lance
0
by: R. Nachtsturm | last post by:
Hi, I would like to create a workable ExpandableObjectConverter for a String Collection (class inheriting from CollectionBase for example and only accepting/returning Strings via...
0
by: taskswap | last post by:
I've successfully set up a PropertyGrid using custom editors and type converters. They work very well. However, I have a spot where I want to generate the TypeConverter converter entries on the fly...
4
by: swartzbill2000 | last post by:
Hello, I have a TypeConverter for converting between this Enum and Strings. Public Enum DeviceNameEnum dnNone dn2500 dnMirror End Enum 'DeviceNameEnum
0
by: Richy | last post by:
Hi, I have a property called Textures that is an array of type String. The property definition is below: <TypeConverter(GetType(Austere3D.Lists.TextureList()))_...
2
by: RedLars | last post by:
Hi, Trying to get an handle on the property grid which I'm finding very handy. I got one problem though that I have not been able to fix. Here is a small example to illustrate the problem;...
6
by: Larry Smith | last post by:
Hi there, Can anyone provide any insight on why MSFT introduced "TypeConverter.GetProperties()". There are two classes for dealing with metadata in .NET, 'Type" and "TypeDescriptor". Each has a...
3
by: Cartoper | last post by:
I have written all these wonderful custom TypeConverter for my enums to display in a PropertyGrid. I would now like to use the same TypeConverter to save out and read in the values to and from a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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
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
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...
0
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.