If you use a dataform with the autogenerate property set to true, you can customize the behaviour and the look and feel of the dataform in the OnAutoGeneratingField Event.
For example you can set the look and feel of required fields to your individual style.
1. step: DataAnnotation for your properties
2. step: Override OnAutoGeneratingField
Define your own DataForm control which inherits from DataForm. Then you can override the OnAutoGeneratingField method and do a lot of tricky things. Manipulating the behaviour of your autogenerated datafields or give them a different style. In my example we used in our project this mechanism to attach a GotFocus and LostFocus-Event to each TextBox and DatePicker, if there is a Required-Attribute defined.
The GotFocus- and LostFocus-Events looks like this:
In this Eventhandlers we use the VisualStateManager to give the controls, if the content is empty, a new visual state “Required” or in the other case the visual state “NotRequired”.
Now you have only to define the two new states in your style and you can enjoy the new Required field effect.
3. step: Add new States to your style
In the VisualStateManager section:
The content style: