Skip to main content
.NET Framework 4.6.2+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

XafApplication.CustomizeTemplate Event

Occurs after a Template has been created.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.2.dll

NuGet Package: DevExpress.ExpressApp

#Declaration

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.

#Remarks

Handle this event to customize a particular template. Use the handler’s CustomizeTemplateEventArgs.Context or CustomizeTemplateEventArgs.Template parameter. For more information, refer to the following topics:

The following code snippet demonstrates how to handle the CustomizeTemplate event to hide toolbars that accompany a nested List View in ASP.NET Core Blazor and Windows Forms XAF applications:

using DevExpress.ExpressApp.Templates;
//...
public class MyHideToolbarController : Controller {
    protected override void OnActivated() {
        base.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;
        base.OnDeactivated();
    }
}

In Windows Forms applications, this event is raised after XAF creates a Template and before the template is assigned to a Window.

For instructions on how to customize a template in an ASP.NET Web Forms application, refer to the following topic: How to: Customize an ASP.NET Web Forms Template.

See Also