EFileTahi-A Posted December 20, 2009 Posted December 20, 2009 I need to customize a property for my UserControl, but I need the property to have several choices inside a combobox, like TextAlignment property, where you have already 3 options (Left, Center, Right) to choose from. Any suggestions? Thank you Quote
Administrators PlausiblyDamp Posted December 21, 2009 Administrators Posted December 21, 2009 Could you not just define an enum containing the valid options and use that as the data type for the property? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
EFileTahi-A Posted December 28, 2009 Author Posted December 28, 2009 Well, how do I do that? Could you show me a small example? enum myEnum { one, two, three }; public myEnum TEST { get { return myEnum; } set { myEnum.one = value; } } Needless to say the above code does not work. How do I assign a selected value to a enum and how do I read from it? Thank you Quote
Administrators PlausiblyDamp Posted December 28, 2009 Administrators Posted December 28, 2009 public enum myEnum { one, two, three }; private myEnum _test; public myEnum TEST { get { return _test; } set { _test = value; } } should do the trick Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
EFileTahi-A Posted December 30, 2009 Author Posted December 30, 2009 It worked like a charm! Thanks again! - THREAD CLOSED - Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.