Collection Editor for enum -C# RRS feed

  • Question

  • I have a userControl to store filters of Destino. My code is below:

    //In UserControl 
    public List<Destino> DestinosFiltro { get; set; }
    public enum Destino
       Receita = 0,
       Despesa = 1,
       Ativo = 2,
       Passivo = 3,
       Transitório = 4

    Then the property DestinosFiltro appears in the Properties Page in Design mode. And when I am trying to edit this property in design time, a collection editor appears and work fine. But when I close the collection editor, the value entered is cleared. The value of the property DestinosFiltro is losted. Where is my mistake?  

    Thank for all.

    Wednesday, April 22, 2015 2:08 PM


All replies

  • Try adding this line to the constructor:

        DestinosFiltro = new List<Destino>();

    Wednesday, April 22, 2015 5:02 PM
  •  Hi Thiago,

    I have tested your code,  Just follow your scenario, It will shows the error message as below.

    So you should do as Viorel suggested.

    Best regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, April 23, 2015 6:22 AM
  • Thanks a lot. It's works fine.
    Thursday, April 23, 2015 2:40 PM