Filtering Property Grid

Grids for WPF Forum

Posted 1 year ago by Eric Gurney
Version: 21.1.1

When filtering a property grid, is there anyway to determine whether all the properties have been filtered out?

I have a listbox that has all the objects that have the properties to view.  When the user selects an object, it displays all it's properties.  When the properties of a particular item all get filtered out, I want to hide the item in the listbox.



Comments (3)

Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA

Hi Eric,

If you attach to the PropertyGrid.FilterApplied event, you could check the propertyGrid.Items.Count value to see if it's zero.  That should only happen if either there were no properties to begin with, or they were all filtered out.

Actipro Software Support

Posted 1 year ago by Eric Gurney

That won't work as I would need the user to select the item for it to apply the filter which defeats the purpose of hiding the filter.  I need to be able to apply the filter manually in code and then check the Item.Count.  Is there any way to do that?

Answer - Posted 1 year ago by Eric Gurney

For anybody need similar functionality in the future...

What I ended up doing was using the DataFilter property in my view models and check if any were included to create a Visibility property for my view model.


IsVisible = Properties.Any(prop => DataFilter(prop, null) == DataFilterResult.Included);

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.