PropertyGrid with objects of different types

Grids for WPF Forum

Posted 15 years ago by Yoni Leitersdorf
Version: 9.1.0501

I would like to use the same PropertyGrid for a number of objects, each of a different type but all inherit from the same base class. What would be the best way to do so, assuming some of the properties are shared across all the types and some are unique to specific types?

Thank you,

Comments (1)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Yoni,

Our PropertyGrid has a SelectObjects (not to be confused with SelectedObject) property, which you can set to an array of objects. The PropertyGrid will then display properties that are common to all the objects in the array. If you make a change to a property, it is pushed to all the underlying objects.

A "common property" is simply defined as having the same name and Type. So even if your classes did not derive from the same base class, you could have common properties. For example, if each object defined a Name property of Type String, then the PropertyGrid would display it.

If you need more advanced functionality then you will probably need to build a custom data factory.

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.