Reputation:
I have created a user control, and now I want to add custom properties to it so they will appear in the Properties toolbar in Vis. Studio. How can this be done?
My custom property will be: "Animation Type" with options "Fade | Blink | Scroll | Blend"
thank you
Upvotes: 2
Views: 237
Reputation: 46148
The designer automatically reads properties of the class and adds them to the properties view. So all you need to do is to create the property with a public getter and setter
public AnimationType AnimationType { get; set; }
There are extra attributes you can apply to the property, for example DefaultValue or EditorBrowsable, that change how it appears in the properties view. All the relevant attributes are in the System.ComponentModel namespace.
Upvotes: 1