不显示属性时,许多对象中选择C#属性网格 [英] dont show property when many object selected C# property grid
问题描述
我知道如何使用这个属性prevent从属性网格显示某个属性 [可浏览(假)]
I know how to prevent a property from being shown in the property grid by using this attribute
[Browsable(false)]
但我想prevent仅当有属性网格中选中多个对象1被浏览这个属性。
but I want to prevent this property from being browsed only when there are more than 1 object selected in the property grid.
我的意思是,当在属性网格中只选定了一个对象,这个属性将被显示,但如果选择2个或多个对象此属性不会浏览的!
I mean that when only one object is selected in the property grid this property will be shown but when 2 or more objects are selected this property won't be browsable!
推荐答案
请注意:我没有做它自己,但根据文档...
Note: I haven't done it myself, but according to the documentation...
你试过 BrowsableAttributes
,记录<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.propertygrid.browsableattributes%28v=vs.80%29.aspx\"相对=nofollow>此处?在您的选择code你很可能修改 propertyGrid.BrowsableAttributes
来体现,如果它是一个单飞选择或多重的选择,并通过相应标记的变量,你应该能有你要找的显示。
Have you tried BrowsableAttributes
, documented here? In your selection code you could probably change the propertyGrid.BrowsableAttributes
to reflect if it's a "solo" selection or "multiple" selection, and by tagging the variables accordingly, you should be able to have the display you're looking for.
这个线程也许可以帮你!
这篇关于不显示属性时,许多对象中选择C#属性网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!