Custom editor for objects in an array

Grids for WPF Forum

Posted 3 years ago by Justin Klein
Version: 15.1.0623

When populating a PropertyGrid via SelectedObject, my understanding is that the correct way to specify my desired editor for a given property is to mark it with the Editor attribute, i.e.:

using ActiproSoftware.Windows.Controls.PropertyGrid.Editors;
[Editor(typeof(ComboBoxPropertyEditor), typeof(PropertyEditor))]
public bool TestValue { get; set; } 


That works fine - however, how would I specify the editor for objects contained in an array property?  For instance:

using ActiproSoftware.Windows.Controls.PropertyGrid.Editors;

bool[] testValue = new bool[20];

[Editor(typeof(ComboBoxPropertyEditor), typeof(PropertyEditor))]
public bool[] TestValue { get { return testValue; } set{ testValue=value; } }

 This will show a ComboBox on the PropertyGrid line listing the name of the array itself - whereas I'm trying to get a ComboBox for each boolean within the array?

Comments (2)

Posted 3 years ago by Justin Klein

Found a workaround: I just set a PropertyEditor that applies to all properties of type bool (including those in the array).  This isn't an explicit per-property specification (as above), but actually works better in my case.  i.e.:

    <ActiPropGrid:PropertyEditor PropertyType="{x:Type system:Boolean}">
Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Justin,

The workaround you are doing is what we should suggest.  I don't think there is another way to specify the property editor for array items.

Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 8 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.