Filtering Property Grid

Grids for WPF Forum

The latest build of this product (v22.1.4) was released 2 months ago, which was before this thread was created.
Posted 27 days ago by Eric Gurney
Version: 21.1.1
Avatar

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.

Thanks,

Eric

Comments (3)

Posted 27 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

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 27 days ago by Eric Gurney
Avatar

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 26 days ago by Eric Gurney
Avatar

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.

e.g.

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

Add Comment

Please log in to a validated account to post comments.