provide several values for a String property

O

Oleg Ogurok

Hi all,

If you look at the properties window of a HyperLink control (during the
design time), you'll notice that its property Target is a System.String,
which has several pre-defined values, such as "_self", "_blank", etc.
Moreover, the designer allows you to enter your own custom property value.

How can I implement the same behavior in my custom control? Is there an
Attribute one can use to supply several pre-defined values?

-Oleg.
 
J

John Saunders

Oleg Ogurok said:
Hi all,

If you look at the properties window of a HyperLink control (during the
design time), you'll notice that its property Target is a System.String,
which has several pre-defined values, such as "_self", "_blank", etc.
Moreover, the designer allows you to enter your own custom property value.

How can I implement the same behavior in my custom control? Is there an
Attribute one can use to supply several pre-defined values?

Yes. You can assign a TypeConverter to your property, and use the
GetStandardValues and GetStandardValuesExclusive methods.
 

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

Members online

No members online now.

Forum statistics

Threads
474,100
Messages
2,570,634
Members
47,240
Latest member
taarariachand

Latest Threads

Top