2016-06-28 132 views
0

扩展WPF工具包包含一个PropertyGrid控件,该控件允许编辑对象属性。 PropertyGrid具有的功能之一是搜索属性名称: enter image description here扩展WPF工具包 - PropertyGrid扩展搜索功能

当前,在搜索时,必须匹配属性名称的确切排序。例如,搜索“宠物”,返回正确的属性。另一方面,搜索“名称”不会返回任何结果。

有没有办法扩展搜索功能,所以它会启用更灵活的搜索?

回答

1

好的找到了解决方案。

我不得不继承PropertyGrid中,覆盖OnFilterChanged方法,并更改过滤谓词:

public class ExtendedPropertyGrid : PropertyGrid 
{ 
    protected override void OnFilterChanged(string oldValue, string newValue) 
    { 
     CollectionViewSource.GetDefaultView((object) this.Properties).Filter 
      = (item => (item as PropertyItem).DisplayName.ToLower().Contains(newValue.ToLower())); 
    } 
} 
0

V2.9有这个BUIT中,刚刚升级扩展WPF工具包