문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top