【问题标题】:Extended WPF Toolkit - PropertyGrid expand search functionality扩展的 WPF 工具包 - PropertyGrid 扩展搜索功能
【发布时间】:2016-06-28 15:00:24
【问题描述】:

扩展的 WPF 工具包包含一个 PropertyGrid 控件,它允许编辑对象属性。 PropertyGrid 的一项功能是搜索属性名称:

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

有没有办法扩展搜索功能,从而实现更灵活的搜索?

【问题讨论】:

    标签: wpf xceed


    【解决方案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()));
        }
    }
    

    【讨论】:

      【解决方案2】:

      V2.9 有这个功能,只需要升级扩展的 wpf 工具包

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-06-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-05-19
        • 1970-01-01
        • 2012-03-08
        • 1970-01-01
        相关资源
        最近更新 更多