2

I have a number of categories on my design time component that are being expanded by default.

I'd like to have them appear collapsed by default, or at least problematically collapse them before the user sees them.

[Category("Misc")]
public int Id
{
    // ...
}

Do I need to use a type converter? The docs on this are pretty sketchy...

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Hotrodmonkey
  • 2,924
  • 3
  • 20
  • 25
  • I don't know if you can collapse them (maybe in a #region?) but attributes can be comma separated. Example: [Category1(), Category(), etc, etc] – AContractor May 08 '13 at 18:55
  • Thanks, but I wasn't looking for the view at development time, but at execution time when the property view was visible. – Hotrodmonkey May 08 '13 at 19:01

1 Answers1

1

I don't think there's a viable way to do this. While you can programmatically collapse a category in a PropertyGrid control, you'd need to get access to the instance being used by Visual Studio (or whatever editor they're using). As far as I know there's no way to control that declaratively, e.g. with an attribute or anything.

It might be possible with a custom UITypeEditor or something, but it would be fragile and need an awful lot of effort, and personally this feels like the kind of thing that should be left to the users' preferences anyway.

Jeremy Todd
  • 3,261
  • 1
  • 18
  • 17