【问题标题】:Property Grid Custom Search Box属性网格自定义搜索框
【发布时间】:2014-05-25 20:42:28
【问题描述】:

我有一个包含很多嵌套项的 PropertyGrid。如何使搜索框仅过滤和显示与搜索字符串匹配的项目?

【问题讨论】:

  • Pasty:我目前正在使用预定义的字符串手动将焦点传递给一个项目。我宁愿有一个可以动态拉入“相似”项目的搜索框。

标签: c# visual-studio-2010 propertygrid


【解决方案1】:

两种方式-

您最好的选择是实现ICustomTypeDescriptor 接口并使用GetProperties() 方法过滤PropertyGrid 中的可见行。

如果你想破解你的方式 - 使用反射将 Browsable 属性设置为 false。 Sample code

这里有一些示例文章/链接,其中包含实现 ICustomTypeDescriptor 的代码 -

http://wraithnath.blogspot.in/2011/01/implementing-icustomtypedescriptor-for.html

PropertyGrid Browsable not found for entity framework created property, how to find it?

http://www.codeproject.com/Articles/189521/Dynamic-Properties-for-PropertyGrid

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-25
    • 2017-11-02
    • 1970-01-01
    • 2013-04-03
    • 2018-12-13
    • 1970-01-01
    • 2019-04-16
    相关资源
    最近更新 更多