Properties/Enum

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to create a property that takes a value from an enumerated type and is displayed in the properties window for a custom control. Any ideas how to go about this anyone?
 
What code have you got so far?

C

--

http://www.typemismatch.com/
(For Developers!)

Martin said:
I am trying to create a property that takes a value from an enumerated
type and is displayed in the properties window for a custom control. Any
ideas how to go about this anyone?
 
Martin,

What you need to do is to help the property grid out a bit
on the way. You do this by provinding a TypeConverter to the
property and tell it to use the EnumConverter.

[TypeConverter(typeof(EnumConverter))]
public MyEnum PropName
{
// add get/set code
}

There are a wide range of converters you can use and you can
also derive your own converter for complex types.

HTH,

//Andreas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top