Show the Main Window in Windows Forms Applications
- 6 minutes to read
This topic details the steps performed after an end-user has been authorized, until the moment the main window is shown to the end-user. The main window, as any other window in XAF applications, is defined by two objects: a control called Template and an abstract entity called Window. A Window, in contrast to a Template, does not contain information on what controls must be located on it. Windows only include the information concerning their functions in the XAF applications. In this topic, you will learn how a Window and Template objects are created and associated to present the main window.
#Create a Window
Stage | Ways to Interfere |
---|---|
Before creating an instance of the Window class, all Controllers listed in the Application Model‘s Action | Subscribe to the Controller. |
Then, a Window is created and all the Controllers are registered in this Window. This means that their Window | Subscribe to the Controller. |
The Controllers that represent the Window | To activate a Window Controller for the main Window only, set its Window Override a Controller’s Window Subscribe to the Controller. |
#Assign a Template to the Window
Stage | Ways to Interfere |
---|---|
To be visualized, the Window creates a Template, a control (e. | Subscribe to the Xaf Use a custom Frame Template Factory to create custom Templates. Register the required Frame Template Factory in a module where the custom Templates are implemented. In this instance, the module should be added to an application to use the custom Templates. For details, refer to the How to: Distribute Custom Templates with Modules topic. |
When a Template is created, all its Action Containers are created as well. Action Containers are the controls that display Actions. The Main | Subscribe to the Xaf |
The created Template is assigned to the Window. |
#Create Controls for Actions
Stage | Ways to Interfere |
---|---|
The Window’s Template |
Subscribe to the Frame. |
#Set the Template’s Settings
Stage | Ways to Interfere |
---|---|
The Template’s ISupport | By default, the Template’s settings are saved to the Application Model‘s Templates | Template node. You can save them to another Application Model node. For this purpose, override the Get You can save the Template’s setting in another store. To do this, implement a custom Template overriding the methods exposed by the IFrame |
The Template is shown. |
#Assign a View to the Window
Stage | Ways to Interfere |
---|---|
The Show |
To imitate the selection of a particular item in the navigation control, inherit from the Show |
The created View is assigned to the current Window. | Subscribe to the Frame. |
#View Controllers are Activated
Stage | Ways to Interfere |
---|---|
View Controllers from the Window’s Frame. | You can manage the activation of a View Controller using the following properties: View Override a Controller’s View Subscribe to the Controller. |
#Assign the Window’s View to the Template
Stage | Ways to Interfere |
---|---|
The View is assigned to the current Window’s Template. This forces the creation of the View’s control (see View. |
Handle the View. |