PropertyGrid & Drop down list style

M

mark.craft

I've just inherited some code that for the main part works, I've got a
properybag that is used to populate the propertygrid. Some of the
options use type converters as the data comes from Enums or stored
data. These options automatically use a dropdownlist to display/be
edited. This is fine but what I want to do is set the style of the
drop down to dropdownlist, to prevent the user being able to type into
the edit control.

I'm just not quite sure where this can be done. I have some other
options that set the editor attribute (e.g. FileNameEditor) , I tried
setting this attribute on one of the Enum options to a typeof(myClass)
where myClass is a class I wrote that inherits dropdownlist and sets
the style in the constructor. This resulted in the option within the
propertygrid being non editable..

I've searched through a ton of stuff but I cant find any clues.. Any
help gratefully received!
 
B

Bob Powell [MVP]

I think that you really need your own TypeConverter that implements the
StandardValues collection. See TypeConverter for details.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 

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

Top