How to assign names to List of Objects in a property

64 Views Asked by At

enter image description hereI use the following code to create a list of objects that can be assigned with values and have unique names in the UI.

public class Test
{
        
  
private int _length;
private Color _color;
private Dictionary<string,object> array2 = new ();
 

           
  [Display(Name = "List of Objects")]
  public Dictionary<string, object> ObjectList
  {
        get { return array2; }
        set { array2 = value; }
  }
    
  public Test()
  {
        array2.Add("test1",_length);
        array2.Add("test2", _color);
 }
   
....
}

For result pls. see attached file !

enter image description here

How can I remove/change string "Count:" - string in second column (upper right corner) ?

When I use GroupName in DisplayAttribute this will have no effect, how can I change UI-look by also grouping values ?

e.g. [Display(Name = "List of Objects", GroupName = "XYZ")]

I can also not select colors anymore, which worked when I used List.

0

There are 0 best solutions below