Question

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...

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top