Category attribute in Property Grid
-
Is it possible to expand a particular category and collapse another particular category in property Grid ? How can we do it. Also if I do not have category , MISC is shown as category . Is it possible to remove "Misc" Thanks , Rajan
-
Is it possible to expand a particular category and collapse another particular category in property Grid ? How can we do it. Also if I do not have category , MISC is shown as category . Is it possible to remove "Misc" Thanks , Rajan
-
No, not AFAIK.
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 4a out now (29 May 2008)Ok.. I need to expand all category or collapse all. I need to change the category name of "MiSC" to some thing meaningful Thanks
-
Is it possible to expand a particular category and collapse another particular category in property Grid ? How can we do it. Also if I do not have category , MISC is shown as category . Is it possible to remove "Misc" Thanks , Rajan
Those category names come from the
System.ComponentModel.CategoryAttribute
that decorate the public properties of the object being displayed in the property grid. Generally, the "Misc" category holds those properties that don't have this attribute. If you are displaying an object of your own making, then you need to add the attribute, which will move them out of "Misc". If you want to "move" other (inherited) properties, you need to override or hide them and change the attribute accordingly. To expand categories you can do this:PropertyGrid pg = new PropertyGrid();
pg.ExpandAllGridItems(); // Expands all the categories in the System.Windows.Forms.PropertyGrid
pg.CollapseAllGridItems(); // Collapses all the categories in the System.Windows.Forms.PropertyGrid// To expand/collapse a specific category
GridItem gi = pg.SelectedGridItem;
if (gi.GridItemType == GridItemType.Category)
{
gi.Expanded = true;
}Scott Dorman
Microsoft® MVP - Visual C# | MCPD President - Tampa Bay IASA Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai