[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
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
  [Expand]Actions
  [Expand]Navigation
  [Expand]Views
  [Expand]List Editors
  [Expand]Property Editors
  [Expand]Templates
  [Expand]Filtering
  [Expand]Reporting
  [Expand]Dashboards
  [Expand]Scheduler and Notifications
  [Expand]Maps
  [Expand]Security
  [Expand]Workflow
  [Expand]Localization
  [Expand]Testing
  [Collapse]Miscellaneous UI Customizations
    How to: Add a Button to a Detail View Using Custom View Item
    How to: Add an XAF Mobile Custom Module
    How to: Adjust the Size and Style of Pop-up Dialogs (ASP.NET)
    How to: Adjust the Windows' Size and Style
    How to: Change an Application Logo and Info
    How to: Create a Custom Control Detail Item
    How to: Customize a Window Caption
    How to: Customize ASP.NET Layout Elements Using Custom CSS Classes
    How to: Customize Export Options of the Printing System
    How to: Customize the Conditional Appearance Module Behavior
    How to: Customize Window Status Messages (WinForms)
    How to: Enable High DPI Support in a WinForms Application
    How to: Implement a Custom Messaging Class
    How to: Implement Client-Side Logic in Mobile Applications
    How to: Include an Action to a Detail View Layout
    How to: Raise XAF Callbacks from Client-Side Events and Process these Callbacks on Server
    How to: Set Images and Captions for Enumeration Values
    How to: Show a Custom Window with an Embedded XAF View
    How to: Show a Custom Windows Form
    How to: Use a Custom Plugin in a Mobile Application
    How to: Use a Custom Splash Screen
    How to: Use a DevExtreme Chart in a Mobile Application
    How to: Use Custom Themes in ASP.NET Applications
  Frequently Asked Questions (FAQ)
 [Expand]API Reference
[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)

How to: Customize a Window Caption

A caption of a typical Windows Forms XAF application Window consists of two parts split by a dash sign. In the main Window, the first part is the active object caption, and the second part is the application name. In a Detail View window, the first part of a caption is specified by the Detail View node's ObjectCaptionFormat property, and the second part is a current class caption.

The same is true of an ASP.NET XAF application. However, the difference is that a browser can modify a caption. For instance, the Microsoft Internet Explorer appends its own name to a caption.

An ASP.NET XAF application does not modify a browser window caption directly and sets a web page title. You can view the HTML source of any ASP.NET application's page. You will notice that the application caption is inserted between <title> and </title> tags.

Note

The approaches described in this topic are not supported by the Mobile platform. If it is necessary to implement these scenarios in your Mobile application, contact us using the Support Center.

Default captions can be changed. This topic describes how to customize captions.

Expanded Set a Custom Text as a Caption

The WindowTemplateController is activated in all Windows, and updates a current Window status and caption. The WindowTemplateController exposes the WindowTemplateController.CustomizeWindowCaption event. This event occurs before a Window caption is updated, and allows you to change that caption. A Window caption is represented by the SplitString class in XAF.

To modify a Window caption, create a custom Window Controller, subscribe to the CustomizeWindowCaption event and handle it. Assign a custom value to the WindowCaption.Text property in the CustomizeWindowCaption event handler. To activate the custom Window Controller in the main Window only, set the TargetWindowType to Main in the Controller constructor. Refer to the WindowController.TargetWindowType and Window.IsMain topics for details.

The following image illustrates a custom caption in a Windows Forms application.

The following image illustrates a custom caption in an ASP.NET application.

Expanded Modify a Part of a Caption

To change the second part of a caption, modify the WindowCaption.SecondPart property in the CustomizeWindowCaption event handler.

The following images illustrate a customized caption with the second part modified.

Expanded Modify a Caption Separator

To change a caption separator, assign a custom value to the WindowCaption.Separator property in the CustomizeWindowCaption event handler.

The following images illustrate a caption with a customized separator.

Expanded Swap Parts of a Caption

To change the order of caption parts, swap the values of WindowCaption.FirstPart and WindowCaption.SecondPart properties in the CustomizeWindowCaption event handler.

The following images illustrate a customized caption with the left and right parts swapped.

Expanded Display Only One Part of a Caption

To display only the second part of a caption, set the WindowCaption.FirstPart to null (Nothing in VB).

Note

You do not have to set the WindowCaption.Separator property to null (Nothing in VB) to disable the separator display when one of the caption parts is an empty string or null (Nothing in VB). The separator will be omitted automatically. Refer to the SplitString topic for details.

The following images illustrate a customized caption.

You can use the WindowTemplateController.UpdateWindowCaption method to refresh a window caption.

Expanded See Also

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