Refreshing a CollectionPropertyDescriptorPropertyModel doesn't Rename when collection is expanded

Grids for WPF Forum

Posted 2 years ago by Guillaume Guimond-Croteau
Version: 19.1.0687
Avatar

I am modifying a property name from the SelectedObject, this property is part of a collection and I want it to be renamed in the Propertygrid at the same time that it is renamed in the selectedObject. Right now I am hooked to ObjectRenamed on the SelectedObject and I find the item in question, then I make item.Refresh(PropertyRefreshReason.ValueChanged). The thing is that it only update the name when the Collection in the PropertyGrid is collapsed, in other words, when I can see the item it doesn't get renamed.

I tryed doing a refresh on the parent item, but in that case I end up losing any expanded items in the collection and I want to avoid that to keep thing intuitive to the user.

Am I missing something or is there a workaround to that?

Thanks!

Comments (4)

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Have you tried putting [NotifyParentPropertyAttribute] on the child property?  If the child property model's ShouldNotifyParentOnValueChange property returns true, then it should trigger the parent's value to refresh without requerying the children.


Actipro Software Support

Posted 2 years ago by Guillaume Guimond-Croteau
Avatar

Hi,

I actually don't want to refresh the parent, since it will forget if any children were expanded. I want to refresh the children directly when this item is renamed from the SelectedObject, not directly from the Propertygrid.

I tried to override ShouldNotifyParentOnValueChange to send true all the time and override Name to add the property, but I don't see any change.

The Children is of type CustomCollectionPropertyModel that herit from CollectionPropertyDescriptorPropertyModel.

The collection itself is of type CustomPropertyModel that herit from PropertyDescriptorPropertyModel.

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Would you be able to throw together a simple sample application that demonstrates the issue? Things like this can be difficult to support in a forum and a sample will help us best understand the exact issue and verify any product changes, if needed. If so, please send to our support email and remove any bin/obj folders from the project before you ZIP or else the attachment may be blocked. Please reference this forum post in the support email.


Actipro Software Support

Answer - Posted 2 years ago by Guillaume Guimond-Croteau
Avatar

The answer was to call NotifyPropertyChanged(nameof(DisplayName)) on the item that was renamed.

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.