Editors in PropertyGrid with Multiple Objects

Editors for WPF Forum

Posted 6 years ago by Nate Smith
Version: 17.2.0665

I am converting my application to the 2017 version of Grids/PropertyGrid and Editors.  I am always using DataObjects on the PropertyGrid where sometimes there is only one item and sometimes there are multiple items of either the same or different types.

For selecting the appropriate Editors I always use the [EditorAttribute] on properties or allow the default to be selected.  I have found that when a single item is selected the expected Editor template is selected, but when mutliple objects are selected, the default is always selected, even when the selected objects are all of the same type and thus have the same [EditorAttribute] value.

As an example, I have an "AlignmentEditor" which is a custom Editor that selects from an enum of text Alignments (e.g. Left, Center, Right.)

My Alignment property has the attribute set like this:  [Editor(typeof(AlignmentPropertyEditor), typeof(PropertyEditor))]

If I have a single Label item selected I get my custom Editor shown in the Property Grid just fine.  If I select two or more Label items selected, the PropertyGrid drops down to the default Enum editor (a ComboBox type editor) instead.

When I check the PropertyModel that I get for my custom Editors the IsMergeable is set to True.

How can I get the old behavior where if the [EditorAttributes] and Names of the multiple objects match, you get the desired Editor rather than the default?

Comments (1)

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

Hi Nate,

Can you put together a new simple sample project that shows this scenario so that we can debug with it and make sure any updates we make will handle your scenario appropriately?  Please send it to our support address and refer to this thread in your email.  Exclude the bin/obj folders in the ZIP and rename the .zip file extension so it doesn't get spam blocked.  Thanks!

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.