Skip to main content
.NET Framework 4.5.2+

WindowTemplateController.UpdateWindowStatusMessage() Method

Refreshes the status bar messages.

Namespace: DevExpress.ExpressApp.SystemModule

Assembly: DevExpress.ExpressApp.v24.1.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public void UpdateWindowStatusMessage()

Remarks

Below is the example of using this method in a custom View Controller. This controller adds a status message that contains the selected objects count, by handling the WindowTemplateController.CustomizeWindowStatusMessages event. The UpdateWindowStatusMessage method is invoked in the ListEditor.SelectionChanged event handler, to refresh the status message when end-user changes the selection.

using System;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.SystemModule;
// ...
public class UpdateWindowStatusMessagesController : ViewController<ListView> {
    private WindowTemplateController windowTemplateController;
    public UpdateWindowStatusMessagesController() {
        TargetViewNesting = Nesting.Root;
    }
    protected override void OnActivated() {
        base.OnActivated();
        windowTemplateController = Frame.GetController<WindowTemplateController>();
        if (windowTemplateController != null) {
            windowTemplateController.CustomizeWindowStatusMessages += 
                windowTemplateController_CustomizeWindowStatusMessages;
        }
    }
    protected override void OnViewControlsCreated() {
        base.OnViewControlsCreated();
        View.Editor.SelectionChanged += Editor_SelectionChanged;
    }
    protected override void OnDeactivated() {
        View.Editor.SelectionChanged -= Editor_SelectionChanged;
        if (windowTemplateController != null) {
            windowTemplateController.CustomizeWindowStatusMessages -= 
                windowTemplateController_CustomizeWindowStatusMessages;
            windowTemplateController.UpdateWindowStatusMessage();
        }
        base.OnDeactivated();
    }
    void windowTemplateController_CustomizeWindowStatusMessages(
        object sender, CustomizeWindowStatusMessagesEventArgs e) {
        e.StatusMessages.Add(
            String.Format("Selected objects count: {0}", View.SelectedObjects.Count));
    }
    void Editor_SelectionChanged(object sender, EventArgs e) {
        windowTemplateController.UpdateWindowStatusMessage();
    }
}
See Also