NotifyParentProperty

Grids for WPF Forum

Posted 10 years ago by JDEV
Version: 4.5.0480
Avatar
Hi,

The NotifyParentProperty attribute does not seem to be supported by PropertyGrid?

Is this planned or how else does one get the summary text of a ExpanableObjectConverter to change when a child property is changed?

Take a Size object for example that expands to show Height and Width. The type converter for Size would display something like "(height,width)". When expanding and changing the width property I want the "(height,width)" string re-built.


Thanks.

Comments (2)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
When dealing with structs like Size, the NotifyParentPropertyAttribute isn't really useful. If the Width property is modified, then the associated parent property needs to be updated as well for the changes to take effect (since the modification of the Width property is actually on a copy of the struct).

The sub-properties of a struct can only be changed in the PropertyGrid if the TypeConverter, associated with the struct, overrides CreateInstance and GetCreateInstanceSupported (the latter of which would need to return true). The PropertyGrid uses these methods to build an updated copy of the struct and update the parent property. This would also update the "value" of the struct, since it would have changed.

For classes that would want to display summary information like the Size type does, then the NotifyParentPropertyAttribute is useful. In the case of classes, you will be modifying the actual instance and not a copy.

Regardless, I've added support for NotifyParentPropertyAttribute to the PropertyGrid and an accompanying QuickStart. Both will be available in the next maintenance release.


Actipro Software Support

Posted 10 years ago by JDEV
Avatar
Thanks. My situation is a class not a struct. I was just using Size as an example.

Looking forward to the update.
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.