Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi-line string in a PropertyGrid

Is there a built-in editor for a multi-line string in a PropertyGrid.

like image 229
fryguybob Avatar asked Sep 24 '08 21:09

fryguybob


2 Answers

I found that System.Design.dll has System.ComponentModel.Design.MultilineStringEditor which can be used as follows:

public class Stuff {     [Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))]     public string MultiLineProperty { get; set; } } 
like image 50
fryguybob Avatar answered Sep 18 '22 23:09

fryguybob


No, you will need to create what's called a modal UI type editor. You'll need to create a class that inherits from UITypeEditor. This is basically a form that gets shown when you click on the ellipsis button on the right side of the property you are editing.

The only drawback I found, was that I needed to decorate the specific string property with a specific attribute. It's been a while since I had to do that. I got this information from a book by Chris Sells called "Windows Forms Programming in C#"

There's a commercial propertygrid called Smart PropertyGrid.NET by VisualHint.

like image 35
Hector Sosa Jr Avatar answered Sep 18 '22 23:09

Hector Sosa Jr