This sample application demonstrates some of the possibilities of sub-classing the MicroFour.StrataFrame.UI.Windows.Forms.StandardForm to extend the functionality of that class.
The EgBaseForm is a class that inherits from the StandardForm and extends it as follows:
To test is out, try the following:
An interesting thing to note is that the sub-classed form has a set of shared (static) "factory" methods that create instances of forms derived form the base class (EgBaseForm). The factory methods allow for the features of the base form that are more runtime driven (as opposed to being design time driven, like the auto-caption update feature) to be more easily used (one method call, rather remembering the combination needed for a feature). For each feature there are two methods: a function to create a form with that feature and a config method that configures the form to use that method. So, feature that can auto-load the form with a single record based on the BO's PK, is supported by two methods:
Typically the create function is used when the form simply needs the features of the base form, nothing else. The configure method is used when the form needs that feature, among others. For example, if a derived form had a constructor that indicated a parent ID of the records to load, which was required, then you could first create an instance of this form, using the parent ID, then call the config method to configure it load a specific ID. The config methods also allow for the features to be easily combined (as makes sense). The CreateAutoLoadAndNavForm shared method does just that. It creates a form that is configured to load data and then to navigate to an ID on load.
They are generics so at runtime they can still be strongly typed. But because the code is in the base form, it only needs to be written once and is maintained in a single place.