PropertyGrid

J

Jon Harrop

How do I control the display and selection of custom types when they are
shown in a PropertyGrid?
 
M

Marc Gravell

This comes down to 2 main things; the TypeConverter and Editor (of the
UITypeEditor sub-type). Both are easy to write, and can be associated
either with an entire type, or specificed on a property-by-property
basis.

The TypeConverter is responsible for object -> string and string ->
object, for suggesting sub-properties (and allowing reconstruction via
sub-properties for immutable types), and for listing simple drop-down
variations.

The EditorAttribute simply assigns an editor of a listed type, and
UITypeEditor is the one that matters.

The UITypeEditor is responsible for custom drop-downs (like the "dock"
window), painting modal pop-ups (like collection editors) and preview
panels (like colors, images, etc).

Google TypeConverter and UITypeEditor for more.

Marc
 

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