I understand that whenever you create a property for a user control, you can set the property value through declarative syntax, so you can have something like this:
<uc1:MyControl id="MyControl1" runat="server" Text="Hello" Number="10" Access="ReadWrite" />
These attributes set the value for properties of type:
- Text is String
- Number is Integer
- Access is Enum
I wouldn’t be able to set a public property of type “Array” or “Control” in declarative markup. (or can I?)
My question is:
What is the complete list of Types that can be set directly with declarative syntax as attributes in a control?
Ok, after some time with this question without being solved, finally I found the official answer in this article at the MSDN library.
Turns out that those properties that can be persisted as attributes are called Simple Properties and must be a string or a type that easily maps to a string. Here’s an extract of the article:
So I had the list almost complete in my question. Properties that can be set directly with declarative syntax (as atributes) must be of the following types: