[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Collapse]eXpressApp Framework
 [Expand]Fundamentals
 [Expand]Getting Started
 [Expand]Concepts
 [Expand]Design-Time Features
 [Expand]Deployment
 [Expand]Task-Based Help
  Frequently Asked Questions (FAQ)
 [Collapse]API Reference
  [Expand]DevExpress.EasyTest.Framework
  [Expand]DevExpress.ExpressApp
  [Expand]DevExpress.ExpressApp.Actions
  [Expand]DevExpress.ExpressApp.AuditTrail
  [Expand]DevExpress.ExpressApp.Chart
  [Expand]DevExpress.ExpressApp.Chart.Web
  [Expand]DevExpress.ExpressApp.Chart.Win
  [Expand]DevExpress.ExpressApp.CloneObject
  [Expand]DevExpress.ExpressApp.ConditionalAppearance
  [Expand]DevExpress.ExpressApp.Dashboards
  [Expand]DevExpress.ExpressApp.Dashboards.Web
  [Expand]DevExpress.ExpressApp.Dashboards.Win
  [Expand]DevExpress.ExpressApp.Data
  [Expand]DevExpress.ExpressApp.DC
  [Expand]DevExpress.ExpressApp.DC.ClassGeneration
  [Expand]DevExpress.ExpressApp.Editors
  [Expand]DevExpress.ExpressApp.EF
  [Expand]DevExpress.ExpressApp.EF.Utils
  [Expand]DevExpress.ExpressApp.FileAttachments.Web
  [Expand]DevExpress.ExpressApp.FileAttachments.Win
  [Expand]DevExpress.ExpressApp.Filtering
  [Expand]DevExpress.ExpressApp.HtmlPropertyEditor.Web
  [Expand]DevExpress.ExpressApp.HtmlPropertyEditor.Win
  [Expand]DevExpress.ExpressApp.Kpi
  [Expand]DevExpress.ExpressApp.Layout
  [Expand]DevExpress.ExpressApp.Maps.Mobile
  [Expand]DevExpress.ExpressApp.Maps.Mobile.Editors
  [Expand]DevExpress.ExpressApp.Maps.Web
  [Expand]DevExpress.ExpressApp.Maps.Web.Helpers
  [Expand]DevExpress.ExpressApp.MiddleTier
  [Expand]DevExpress.ExpressApp.Mobile
  [Expand]DevExpress.ExpressApp.Mobile.Editors
  [Expand]DevExpress.ExpressApp.Mobile.MobileModel
  [Expand]DevExpress.ExpressApp.Mobile.SystemModule
  [Expand]DevExpress.ExpressApp.Mobile.Templates
  [Expand]DevExpress.ExpressApp.Model
  [Expand]DevExpress.ExpressApp.Model.Core
  [Expand]DevExpress.ExpressApp.Model.NodeGenerators
  [Expand]DevExpress.ExpressApp.ModelEditor
  [Expand]DevExpress.ExpressApp.Notifications
  [Expand]DevExpress.ExpressApp.Notifications.Web
  [Expand]DevExpress.ExpressApp.Notifications.Win
  [Expand]DevExpress.ExpressApp.Office.Win
  [Expand]DevExpress.ExpressApp.PivotChart
  [Expand]DevExpress.ExpressApp.PivotChart.Web
  [Expand]DevExpress.ExpressApp.PivotChart.Win
  [Expand]DevExpress.ExpressApp.PivotGrid
  [Expand]DevExpress.ExpressApp.PivotGrid.Web
  [Expand]DevExpress.ExpressApp.PivotGrid.Win
  [Expand]DevExpress.ExpressApp.Reports
  [Expand]DevExpress.ExpressApp.Reports.Web
  [Expand]DevExpress.ExpressApp.Reports.Win
  [Expand]DevExpress.ExpressApp.ReportsV2
  [Expand]DevExpress.ExpressApp.ReportsV2.Mobile
  [Expand]DevExpress.ExpressApp.ReportsV2.Web
  [Expand]DevExpress.ExpressApp.ReportsV2.Win
  [Expand]DevExpress.ExpressApp.Scheduler
  [Expand]DevExpress.ExpressApp.Scheduler.Web
  [Expand]DevExpress.ExpressApp.Scheduler.Win
  [Expand]DevExpress.ExpressApp.ScriptRecorder
  [Expand]DevExpress.ExpressApp.ScriptRecorder.Web
  [Expand]DevExpress.ExpressApp.ScriptRecorder.Win
  [Expand]DevExpress.ExpressApp.Security
  [Expand]DevExpress.ExpressApp.Security.Adapters
  [Expand]DevExpress.ExpressApp.Security.ClientServer.Wcf
  [Expand]DevExpress.ExpressApp.Security.EF.Adapters
  [Expand]DevExpress.ExpressApp.Security.Strategy
  [Expand]DevExpress.ExpressApp.Security.Xpo.Adapters
  [Expand]DevExpress.ExpressApp.StateMachine
  [Expand]DevExpress.ExpressApp.SystemModule
  [Expand]DevExpress.ExpressApp.Templates
  [Expand]DevExpress.ExpressApp.Templates.ActionContainers
  [Expand]DevExpress.ExpressApp.TreeListEditors
  [Expand]DevExpress.ExpressApp.TreeListEditors.Web
  [Expand]DevExpress.ExpressApp.TreeListEditors.Win
  [Expand]DevExpress.ExpressApp.Updating
  [Expand]DevExpress.ExpressApp.Utils
  [Expand]DevExpress.ExpressApp.Validation
  [Expand]DevExpress.ExpressApp.Validation.Web
  [Expand]DevExpress.ExpressApp.Validation.Win
  [Expand]DevExpress.ExpressApp.ViewVariantsModule
  [Expand]DevExpress.ExpressApp.Web
  [Expand]DevExpress.ExpressApp.Web.Controls
  [Expand]DevExpress.ExpressApp.Web.Editors
  [Expand]DevExpress.ExpressApp.Web.Editors.ASPx
  [Expand]DevExpress.ExpressApp.Web.SystemModule
  [Collapse]DevExpress.ExpressApp.Web.Templates
   [Collapse]BaseXafPage Class
     BaseXafPage Members
     BaseXafPage Constructor
    [Expand]BaseXafPage Properties
    [Collapse]BaseXafPage Events
      ActionContainersChanged Event
      CustomizeTemplateContent Event
      ViewChanged Event
    [Expand]BaseXafPage Methods
   [Expand]CustomizeTemplateContentEventArgs Class
   [Expand]TemplateContentSettings Class
    TemplateType Enumeration
  [Expand]DevExpress.ExpressApp.Web.Utils
  [Expand]DevExpress.ExpressApp.Win
  [Expand]DevExpress.ExpressApp.Win.Core
  [Expand]DevExpress.ExpressApp.Win.Editors
  [Expand]DevExpress.ExpressApp.Win.Model
  [Expand]DevExpress.ExpressApp.Win.SystemModule
  [Expand]DevExpress.ExpressApp.Win.Templates
  [Expand]DevExpress.ExpressApp.Win.Templates.Navigation
  [Expand]DevExpress.ExpressApp.Workflow
  [Expand]DevExpress.ExpressApp.Workflow.Win
  [Expand]DevExpress.ExpressApp.Xpo
  [Expand]DevExpress.ExpressApp.Xpo.Utils
  [Expand]DevExpress.Persistent.Base
  [Expand]DevExpress.Persistent.Base.General
  [Expand]DevExpress.Persistent.Base.ReportsV2
  [Expand]DevExpress.Persistent.Base.Security
  [Expand]DevExpress.Persistent.BaseImpl
  [Expand]DevExpress.Persistent.BaseImpl.EF
  [Expand]DevExpress.Persistent.BaseImpl.EF.PermissionPolicy
  [Expand]DevExpress.Persistent.BaseImpl.PermissionPolicy
  [Expand]DevExpress.Persistent.Validation
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

BaseXafPage.CustomizeTemplateContent Event

Occurs when the template content is created.

Namespace:DevExpress.ExpressApp.Web.Templates
Assembly:DevExpress.ExpressApp.Web.v18.2.dll

Expanded Syntax

Expanded Event Data

The event handler receives an argument of type CustomizeTemplateContentEventArgs containing data related to this event.

The following CustomizeTemplateContentEventArgs properties provide information specific to this event.
Property Description
TemplateContent Gets a User Control that specifies the BaseXafPage page's content.

Expanded Remarks

Handle this event to customize template content. For instance, you can change the application logo displayed in the top-left corner.

Note

The CustomizeTemplateContent event is not designed for in-depth template customization. Instead, use the approach described at How to: Customize an ASP.NET Template topic.

Open the Default.aspx.cs (Default.aspx.vb) file and add the Page_Init method to the Default class to handle the Page.Init event, and then subscribe to the CustomizeTemplateContent event. Use the CustomizeTemplateContentEventArgs.TemplateContent parameter or TemplateContent property to access the template content. The template content exposes the required Image control via the HeaderImageControl property.

With this code, the application logo will be loaded from the CustomLogo.png file located in the Images folder of the ASP.NET application project.

The image is specified by the DefaultThemeImageLocation and ImageName properties of the ThemedImageControl, located on the main window Template. The ImageName property specifies the Logo image name and the DefaultThemeImageLocation attribute specifies the location where XAF searches for this image. The following list explains how these property values are treated.

  1. If the DefaultThemeImageLocation attribute value begins with a tilde character ("~"), it is treated as a relative path to the image specified by the ImageName attribute.
  2. If the DefaultThemeImageLocation attribute value does not begin with a tilde character, this value is concatenated with the ImageName attribute value. The concatenation result is treated as the name of a resource from the DevExpress.Web.ASPxThemes.18.2.dll.
  3. If the DefaultThemeImageLocation attribute value is not specified or is an empty string, then the ImageName attribute value is treated as the name of a resource image without the extension (an example is available in the How to: Change an Application Logo and Info topic).

You can access other controls of a template in a similar way. If a control is not directly exposed, use the Control.FindControl to search for it. Review the template's *.ascx file to determine the ID of the necessary control. You can find the ascx files at %PROGRAMFILES(x86)%\DevExpress 18.2\Components\Sources\DevExpress.ExpressApp\DevExpress.ExpressApp.Web\Resources\.

If modifying the Default.aspx.cs (Default.aspx.vb) source is not appropriate in your scenario, e.g., you want to access the template content from a module, handle the XafApplication.CustomizeTemplate event. Get the BaseXafPage object by casting the CustomizeTemplateEventArgs.Template parameter to the BaseXafPage type and then subscribe to the CustomizeTemplateContent event.

Instead of handling the CustomizeTemplateContent event, you can apply a custom template and modify the ThemedImageControl element in the following manner.

Expanded See Also

Is this topic helpful?​​​​​​​