ModelObjectFormDefiner

This class scans the properties of a model object and creates field definitions for the writeable ones whose types are supported. ModelObjectFormDefiner works in conjunction with the FieldDefinitionRegistry class.

Properties

public FieldDefinitionRegistry DefinitionRegistry { get; private set; }
Holds a reference to the FieldDefinitionRegistry object being used to obtain field definitions. By default this will be the Default instance returned by the FieldDefinitionRegistry, but a different instance can be supplied to the constructor of ModelObjectFormDefiner. This is useful if you need to create specialised definition registry objects - use the FieldDefinitionRegistry.Create() static method to create such an instance..

public object ModelObject { get; set;}
Holds a reference to the object whose properties will be edited by the data entry form being created. The properties of this object are scanned using Reflection to determine the types of input controls to be created.


Methods

public IEnumerable<BaseFieldDefinition> FieldDefinitionList();
Builds and returns a FieldDefinitionList object containing field definitions for the writeable properties found in the type of the ModelObject property.


Events

public event FieldDefinitionEvent FieldDefinitionRequired
This event is fired when the class is about to obtain a field definition object for a property. The event handler can supply a field definition object in the FieldDefinition property of the FieldDefinitionEventArgs object passed as a parameter. If the handler leaves the FieldDefinition property as null then the FieldDefinitionRegistry class will be used to obtain a definition. Alternatively, the handler can set the Cancel property to true - this indicates that the property should not be included in the entry form at all.

public event FieldDefinitionEvent FieldDefinitionCreated
This event is fired after a field definition object has been obtained. Handlers of this event have an opportunity to customize the field definition, such as setting maximum lengths for text fields, or the filters for file picker fields. The handler is passed an instance of FieldDefinitionEventArgs containing the field definition object and the name of the property which produced it (the Cancel property is ignored by this event).

Last edited Oct 21, 2014 at 2:45 PM by DevKnightlie, version 7