XafApplication.CustomizeTemplate Event
Occurs after a Template has been created.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v21.2.dll
NuGet Package: DevExpress.ExpressApp
Declaration
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
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() {
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();
}
}
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.