PropertyGrid.Refresh

Grids for WPF Forum

Posted 8 years ago by Matt Roberts
Version: 10.1.0523
Avatar
I am using a PropertyGrid, populated with a number of PropertyGridPropertyItems and PropertyGridCategoryItems. I have a DataFilterGroup attached to the DataFilter property of the grid, and there are a number of simple filters within it.

When I change the IsEnabled flag for any of the leaf-level filters within the PropertyGrid, and then call PropertyGrid.Refresh(), the filtering is not reapplied to the view. If, instead of calling Refresh(), I simply save the members in the Items property into a temporary list, clear the Items property, then put back the members of the Items property, the filter is applied properly.

It was my understanding that Refresh() should reapply the DataFilter. Is this not the case?

Comments (3)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Matt,

If you are populating Items explicitly, then DataFilter cannot be used. The PropertyGrid builds a ListCollectionView from several of it's properties (such as SelectedObject(s), Properties, AreAttachedPropertiesBrowsable, AreInheritedPropertiesBrowsable, etc) and then sets ItemsSource to that collection view. The DataFactory is used to generate the "items" and the DataFilter is applied to the ListCollectionView.Filter property.

Calling Refresh causes the PropertyGrid to regenerate the ListCollectionView, which in turn reapplies the DataFilter.

So if you use Items or ItemsSource directly, then you'd need to add your own filtering logic by using a ListCollectionView and hooking into the Filter property.


Actipro Software Support

Posted 8 years ago by Matt Roberts
Avatar
Strangely enough, the DataFilter does work when populating Items directly. I can attach a collection of PropertyGridItems to Items, and a DataFilter, and the view will reflect the filter.

For some reason, the PropertyGrid simply doesn't detect when the DataFilter changes once it has been attached.
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Matt,

If you could please put together a small sample project that reproduces the issue and email it over to our support address then we can take a closer look.

The DataFilter is only referenced in one location in the PropertyGrid code and that's in a private callback that we assign to the Filter property of a ListCollectionView we create based on the results of calling DataFactory.GetDataAccessors.

The Items and ItemsSource properties are not used by the DataFactory at all. The PropertyGrid.Properties collection is used by the DataFactory, which is the default content property. But it sounds like you are not using that.

But again, if you can put together a small project we can clear this up much more quickly.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 15 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.