Question

I have a PropertyGrid (winform) that contains a list of positions.

private ValuesCollection _position1 = new ValuesCollection();

public ValuesCollection Position1
{
   get { return _position1; }
   set
   {
     _position1 = value;
   }
}

ValuesCollection this class that I made with the following article: Customized display of collection data in a PropertyGrid

Each object in the list it belongs to class Values​​:

[TypeConverter(typeof(ExpandableObjectConverter))]
public class Values
{
    [Browsable(false)]
    public string Name { get; set; }
    public virtual double Value { get; set; }

    public Values()
        : this(null, 0)
    {

    }
    public Values(string name, double value)
    {
        Name = name;
        Value = value;

    }

    public override string ToString()
    {
        return Value.ToString();
    }
}

My problem is that I can not edit in the first level when the list opens because each item is an object.

enter image description here

I have to open another level (open the object itself) and edit there.

enter image description here

I want to edit in the first level and not open any object alone. I have not found a way to do it, does anyone have an idea?

(P.S. I do not want to use the Collection Editor.)

Was it helpful?

Solution

you could implement a TypeConverter for your Values class

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top