Propertygrid Question / Longer Strings

M

Matthias S.

Hi,

When viewing certain properties in the VS C# Express Property Editor, the
property can be edited by just typing into the corresponding field in the grid,
or by pressing the [...] button at the right end of the field, which will pop up
an edit-box (which is very convinient for longer texts).

I'd like to add this functionality to my app. How do I tell the PropertyGrid it
should allow the user to pop up that edit-box? I was looking through the
Attributes in the ComponentModel namespace, but couldn't find anything. Is this
not a build in functionality of the PropertyGrid?

Thanks in advance!
 
N

Nicholas Paldino [.NET/C# MVP]

Matthias,

In order to do this, you have to have your class attribute its
properties with the appropriate attributes. In this case, you want to use
the Editor attribute, located in the System.ComponentModel namespace. For
the expanded text box, you would want to use the following declaration on
the property (which is of type string, of course):

[Editor("System.ComponentModel.Design.MultilineStringEditor, System.Design,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
typeof(UITypeEditor))] You would have to change the Version and
PublicKeyToken (maybe not this one, but a possibility) for the version of
..NET you are using, of course.-- - Nicholas Paldino [.NET/C#
MVP] - (e-mail address removed)
 

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