Declined
Last Updated: 30 Nov 2020 14:43 by ADMIN
Yusi
Created on: 08 Feb 2020 04:52
Category: PropertyGrid
Type: Bug Report
0
PropertyGrid does not filter properties by category name

Problem: I'd like to filter the properties to be displayed by their category names defined by the Category attribute. Based on the doc here (https://docs.telerik.com/devtools/winforms/controls/propertygrid/features/filtering), my understanding is to add a FilterDescriptor like this: New FilterDescriptor ("Category", FilterOperator.Contains, "some category name"). But it turned out to only filter by property name, not category name. Any misunderstanding or possible issue? Thank you for looking into this.

Reproduce:

1. Define a class like this:

    Private Class TestClass
        <Category("Cat1")> Public Property Property1 As Integer = 1
        <Category("Cat1")> Public Property Property2 As String = "Test 2"
        <Category("Cat2")> Public Property Property3 As String = "Test 3"
    End Class

2. Initialize a RadPropertyGrid in the Form.Load event:

        Dim testObj As New TestClass
        RadPropertyGrid1.EnableFiltering = True
        Dim filter As New FilterDescriptor("Category", FilterOperator.Contains, "2")
        RadPropertyGrid1.FilterDescriptors.Add(filter)
        RadPropertyGrid1.SelectedObject = testObj

3. The right property to be displayed should be Property3, but it turned out to be Property2

 

Example project: attached.

Thank you team!

 

Attached Files:
4 comments
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 25 Feb 2020 09:48
Hello, Yusi,

I am glad that the provided solution works for your case.

We will update the documentation article about filtering in order to avoid any further confusion in our customers. 

Should you have further questions please let me know.

 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Yusi
Posted on: 19 Feb 2020 04:57

Thank you, Dess.

 

The approach you provided did work for me - problem solved.

However, I would still ask if you might push the team to update the document in the link above (in the original thread), as it may mislead other users new to this function. It will make this perfect product a better one.

 

Regards,

Yusi

ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 14 Feb 2020 12:39

Hello, Yusi,

The provided sample project and detailed information are greatly appreciated. 

If you need to filter by the category value, not the property name, in addition to the added FilterDescriptor, it is necessary to set the PropertyGridElement.ToolbarElement.FilterPropertyName property to "Category". 

      Me.RadPropertyGrid1.PropertyGridElement.ToolbarElement.FilterPropertyName = "Category"
Thus, you will achieve the desired behavior even after the first click of the button.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Yusi
Posted on: 12 Feb 2020 06:41

Hi team,

Please refer to the attached project for more info. It seems somehow the PropertyName of the new FilterDescriptor fails to apply to the PropertyGrid control by adding the filter ONCE. When clear the FilterDescriptorCollection and add the same filter for a SECOND time, it works as expected.

How to reproduce:

1. Run the project

2. Click the button in the form once which is supposed to filter category which contains "2". It shows "Property2" in "Cat1" category.

3. Click the button again, which removes previous filters and add the same one again. It shows "Property3" in "Cat2" category.

 

Please help look into this. Thank you.

 

Best,

Yusi

Attached Files: