Bohn
Bohn

Reputation: 26919

Custom Property doesn't show in Properties window of the Custom control

I said File->New->Control Library

Dropped a ListView on its form, ADDED a new static class to it like this:

namespace WindowsFormsControlLibrary1
{
    public  static class TestClass
    {
        [Category("Appearance")]
        public static Color InsertionMarkColor { get; set; }
    }
}

But I am expecting to a see a property called InsertionMarkColor when I use this in a test application but it doesn't show there. Why?
Note: If I directly copy-paste that InsertionMarkColor in the source code of the Library, it shows and works but if I want to move it like the code above to a separate class, it doesn't work...What do you think is missing?

Upvotes: 1

Views: 126

Answers (1)

LarsTech
LarsTech

Reputation: 81620

This worked for me:

public class MyListView : ListView {

  [Category("Appearance")]
  public Color InsertionMarkColor { get; set; }

}

Upvotes: 1

Related Questions