This project has moved and is read-only. For the latest updates, please go here.

Display ExpandableObject as List of elements

Apr 28, 2012 at 2:40 PM

Hi there,

in my class which I want to associated with PropertyGrid, there is a Property

List<Signal> Signals

Signal.cs looks like this:

public string Name { get; set; }
public string Value { get; set; }

If I set the attribute [ExpandableObject], I only get the basic fields "Type", "Parent", "Root" etc. shown.
Instead, I'd like to display all the elements of my List<Signal> in PropertyGrid like:

signalname1          valuename1
signalname2          valuename2

Is there a possibility to implement an Editor for the expanded objects?

Any help is appreciated!


Apr 30, 2012 at 2:17 PM



Since your property is a collection, have you tried to use the CollectionEditor instead?  To try it out, remove the ExandableObject attribute from your Signals property.  Run your application and look at the default editor used by the PropertyGrid for your Signals property.  If it doesn't use the CollectionEditor by default, you may set it like this:

public class MyClass

  [Editor( typeof( Xceed.Wpf.Toolkit.PropertyGrid.Editors.CollectionEditor ), typeof( Xceed.Wpf.Toolkit.PropertyGrid.Editors.CollectionEditor ) )]
  public List<Signal> Signals



May 3, 2012 at 10:04 AM

Yes, I tried CollectionEditor, but I need to use my own, custom Editor. I could display the signals in a ComboBox as well, but I prefer displaying them directly in PropertyGrid (without clicking on a ComboBox or showing in a new window).

So I guess I need to upgrade my custom editor to display the signals in PropertyGrid?