This project is read-only.

Subclassing DynamicForm

Question:

How do I permanently override certain default values on the DynamicForm and DynamicFormRenderEngine classes?

How do I add or define custom properties/methods in the form that's created?

Answer:

The answer to these questions is the same as most basic Object Oriented advice… that you should never use the DynamicForm  class directly in your app, rather, you should sub-class it into you own class and extend it from there as needed.

It only takes two steps:

First, subclass the DynamicFormsRenderEngine class, overriding the default values of any class properties that you want to change, and also adding any new properties or methods you may need:

image_thumb28

Next, define you own DynamicForm subclass, injecting your own custom MyDynamicFormsRenderEngine class defined above.

You can also add any new controls to the form, or change any of the properties of the native form controls (like cmdSave, cmdCancel, lblHeading).

image_thumb40

Last edited Sep 9, 2012 at 5:35 AM by mattslay, version 22

Comments

No comments yet.