XafApplication.CreateCustomTemplate Event
Occurs when creating a Template.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v26.1.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Event Data
The CreateCustomTemplate event's data class is CreateCustomTemplateEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Application | Provides access to the XafApplication object. |
| Context | Returns the context in which a Template is created. |
| Template | Specifies the Template which is created in a XafApplication.CreateCustomTemplate event handler. |
| UseDefaultTemplate | Defines whether the application creates default templates on startup. |
Remarks
In Windows Forms and ASP.NET Core Blazor applications, this event is raised when a Window is created. Handle this event to create a custom Template for this Window. Use the handler’s CreateCustomTemplateEventArgs.Context parameter to create a custom Template for a particular context. For details, refer to the Template Customization, How To: Create a Custom Blazor Application Template, How to: Create a Custom WinForms Ribbon Template and How to: Create a Custom WinForms Standard Template topics.
The CreateCustomTemplate event is triggered at an XAF WinForms application’s startup, once or twice. This depends on the conditions below.
| When the Event is Triggered | When to Handle the Event | |
|---|---|---|
| 1 | On the application’s startup, before the Application Model loads. | To create custom Logon or Main Window templates that do not require the Application Model. If you handle the event at this time, the application creates templates in a separate thread and demonstrates a reduced startup time. |
| 2 | On the application’s startup, after the Application Model loads - if no custom templates were passed the first time the event was triggered. | To get Logon or Main Window templates created the first time the event was triggered or to create templates that depend on the Application Model for their settings. |