Skip to main content

WindowTemplateController Class

Allows you to update the current Window status messages and caption.

Namespace: DevExpress.ExpressApp.SystemModule

Assembly: DevExpress.ExpressApp.v26.1.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public class WindowTemplateController :
    WindowController

Remarks

XAF activates WindowTemplateController in all Windows. The controller exposes two public events that you can use to customize the Window’s status message and caption:

The following code snippet specifies a custom caption and replaces the default status message in an XAF Windows Forms application:

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.SystemModule;

namespace MySolution.Win.Controllers;

public class CustomizeWindowController : WindowController {
    public CustomizeWindowController() { }

    protected override void OnActivated() {
        base.OnActivated();
        WindowTemplateController controller = Frame.GetController<WindowTemplateController>();
        controller.CustomizeWindowCaption += Controller_CustomizeWindowCaption;
        controller.CustomizeWindowStatusMessages += Controller_CustomizeWindowStatusMessages;
    }

    private void Controller_CustomizeWindowCaption(object sender,
    CustomizeWindowCaptionEventArgs e) {
        e.WindowCaption.Text = "My Custom Caption";
    }

    private void Controller_CustomizeWindowStatusMessages(object sender,
    CustomizeWindowStatusMessagesEventArgs e) {
        e.StatusMessages.Clear();
        e.StatusMessages.Add("My Custom Status Message");
    }

    protected override void OnDeactivated() {
        base.OnDeactivated();
        WindowTemplateController controller = Frame.GetController<WindowTemplateController>();
        controller.CustomizeWindowCaption -= Controller_CustomizeWindowCaption;
        controller.CustomizeWindowStatusMessages -= Controller_CustomizeWindowStatusMessages;
    }
}

Custom window caption and status message in a Winforms application

You can use the UpdateWindowCaption and UpdateWindowStatusMessage() methods to refresh the window caption and status messages when required.

For more examples and detailed information about window captions and status messages, refer to the following topics:

Implements

See Also