a dropdown list in the "Properties" window

L

leodippolito

Hello sirs,


I have developed a custom webcontrol, that can be used in a webform.
The custom control inherits from TextBox webcontrol.


I need to have a public property in this custom control that will show
as a dropdown list in the "Properties" window of Visual Studio IDE.


The options for selection in this dropdown would be the
variables/objects declared in the webform, that is, the parent
container of the custom control.


My problem: I don't know how to do this.


Is there any hint, advice, sample, start point to give me?


TIA,
Leonardo
 
T

Teemu Keiski

Hi,

simple way is to create a enum (enumeration) which represents these values
and have that as type of the property. It would get a selection list in
Property Browser automatically.

However, as you say that options consist of other objects on the form, then
it already requires a custom type converter and you'd apply this to be the
type converter for the property in question.

Implementing a Type Converter
http://msdn.microsoft.com/library/d...guide/html/cpconimplementingtypeconverter.asp
 
L

leodippolito

I could implement sucessfully a TypeConverter. If I have an ArrayList
of strings, it shows up as a dropdownlist in Visual Studio IDE.

But I don't know how to pass to the type converter class a list of
declared objects in the form that the control is placed.

Any idea?

TIA,
Leonardo
 

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
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top