App fields are pieces of information that can be added to an app. This can be useful if your app requires some kind of configuration or settings. App fields have a name and a type. In the example above, we added a field for storing the url of the web page to display in the iframe.
For a property to be considered an app field, it must be declared as public read-write, i.e. the property has the public
access modifier and have both a get
and a set
accessor.
App fields must also have one of the following supported types:
enum
byte
short
int
long
bool
double
float
string
Guid
DateTime
TimeSpan
Nullables and Lists of the above types are also supported, e.g. int?
, List<string>
and List<DateTime?>
.
Field attributes
By decorating your fields with one, or more, of the following attributes you can customize how the field is displayed, edited and/or validated.
Datatype
By default, Weavy will look at the property type (in this case string
) when deciding which editor to use for the field. By decorating a field with the [DataType]
attribute you can specify an additional type to associate with the field. This value will then be used by the UI to determine which editor to use for the field.