Skip to main content
.NET Framework 4.5.2+

XafApplication.CustomizeTemplate Event

Occurs after a Template has been created.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v22.1.dll


public event EventHandler<CustomizeTemplateEventArgs> CustomizeTemplate

Event Data

The CustomizeTemplate event's data class is CustomizeTemplateEventArgs. The following properties provide information specific to this event:

Property Description
Context Returns the context in which the Template to be customized was created.
Template Provides access to the Template to be customized.


In Windows Forms applications, this event is raised after a Template has been created and before it is set for a Window. Handle this event to customize a particular Template. For this purpose, use the handler’s CustomizeTemplateEventArgs.Context or CustomizeTemplateEventArgs.Template parameter. For details, refer to the Template Customization and How to: Access the Navigation Control topics.

The following code snippet demonstrates how to hide toolbars accompanying a nested List View in a Windows Forms XAF application by handling the CustomizeTemplate event.

using DevExpress.ExpressApp.Templates;
public class MyHideToolbarController : Controller {
    protected override void OnActivated() {
        Application.CustomizeTemplate += Application_CustomizeTemplate;
    void Application_CustomizeTemplate(object sender, CustomizeTemplateEventArgs e) {
        if (e.Context == TemplateContext.NestedFrame) {
            ISupportActionsToolbarVisibility template = 
                e.Template as ISupportActionsToolbarVisibility;
            if (template != null) template.SetVisible(false);
    protected override void OnDeactivated() {
        Application.CustomizeTemplate -= Application_CustomizeTemplate;

To learn how to customize a template in an ASP.NET Web Forms application, refer to the How to: Customize an ASP.NET Web Forms Template topic.

See Also