2

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

1
  • It amazes me that you didn't take the few minutes necessary to try this yourself. Did you really not realize there is no magic here, that they are normal properties? Commented Apr 30, 2010 at 17:04

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.