Enum property with child properties

Grids for WPF Forum

Posted 9 years ago by Magnus Lindhe
Version: 15.1.0624

Is it possible to have a enum property with child properties in such a way that when the enum is changed the child properties will change? Can this be done using a factory derived from TypeDescriptorFactory or do I need to also create custom IDataAccessor implementations to achieve this?

Example of my current grid where I have two properties Mode and Transport. I would like the nested properties on Transport to be displayed under the enum property Mode. Another possiblity is to have a custom enum editor on the Transport property but still keep its nested properties. 

[Modified 9 years ago]

Comments (1)

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

Hi Magnus,

Since an enum property is a leaf node, it can't really have any child properties, as least unless you manually add them via a custom factory.  I think your other thread asked about that.

As far as refreshing the PropertyGrid when this particular property changes, you could attach to a PropertyGrid.PropertyChanged event and call the Refresh method either on the entire PropertyGrid or on the specific data accessor in response to your enum property changing.  If you had a custom data accessor for the Enum, you could override its OnPropertyChanged method and then maybe look at its Parent data accessor and find the related child data accessor for the Transport property and call Refresh on it.

Actipro Software Support

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.