c# - How to show values for custom property during design-time? -


i new wpf c#, trying create user control custom properties. have property name planet.

and property can take values mercury, venus, earth , mars.

during design time, when include control in application, , type property name, want visual studio prompt 4 values. when use alignment property control , shows left, right, center..

can advice me on how this?

you need create depedency property of type enum. refer below code.

public partial class usercontrol1 : usercontrol {     public usercontrol1()     {         initializecomponent();     }       public planets planet     {         { return (planets)getvalue(planetproperty); }         set { setvalue(planetproperty, value); }     }       public static readonly dependencyproperty planetproperty =         dependencyproperty.register("planet", typeof(planets), typeof(usercontrol1), new uipropertymetadata(planets.mercury));   }  public enum planets {      mercury,      venus,      earth,     mars  } 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -