属性网格只显示某些品类 [英] Property grid only show some category
本文介绍了属性网格只显示某些品类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个PropertyGrid的是一个对象,具有以下属性类别上使用:样式,演算和其它
I got a PropertyGrid that is use on an object that have the following property category : Style, Calcul and Misc
我要的是只显示给用户的演算类,但我不希望使用浏览的属性,因为我希望所有这些属性在Visual Studio中可见。
What I want is to only show to the user the Calcul category, but I don't want to use the browsable attribute because I want all these property to be visible in Visual studio.
所以,我需要的,是一个IN- code解决方案。
So, what I need, is an in-code solution.
我使用。NET 3.5 C#
I use .Net 3.5 c#
推荐答案
的PropertyGrid
有一个属性 - BrowsableAttributes
;这个分配您的类别:
PropertyGrid
has a property - BrowsableAttributes
; assign this your categories:
propGrid.BrowsableAttributes = new AttributeCollection(
new CategoryAttribute("Calcul"));
和(希望),它应该工作。
And (hopefully) it should work.
这篇关于属性网格只显示某些品类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文