Back to Devexpress

XAF0022: Avoid using the ShowViewStrategy.ShowView method

expressappframework-404103-debugging-testing-and-error-handling-code-diagnostics-xaf0022.md

latest2.7 KB
Original Source

XAF0022: Avoid using the ShowViewStrategy.ShowView method

  • Feb 04, 2026

Severity: Warning

Avoid using the ShowViewStrategy.ShowView method. It is for internal use.

To display a View in the XAF UI, use Actions, ShowViewInPopupWindow, ShowMessage, etc. Refer to the following topic for details: Ways to Show a View.

Example

Invalid Code

csharp
using DevExpress.ExpressApp.SystemModule;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp;
using DevExpress.Xpo;

namespace TestApplication.Module.PlatformSpecificModulesTest {
    public class TestClass {
        public XafApplication Application { get; set; }

        void Show(DashboardView view) {
            ShowViewParameters svp = new ShowViewParameters(view);
            svp.Context = TemplateContext.ApplicationWindow;
            svp.CreateAllControllers = true;
            // Avoid using Application.ShowViewStrategy.ShowView
            Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null)); // Warning
        }
    }
}

Valid Code

csharp
using DevExpress.ExpressApp.SystemModule;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp;
using DevExpress.Xpo;

namespace TestApplication.Module.PlatformSpecificModulesTest {
    public class TestClass {
        public XafApplication Application { get; set; }

        void Show(DashboardView view) {
            // This code meets the requirements
            Application.ShowViewStrategy.ShowViewInPopupWindow(view);
        }
    }
}

How To Fix

To display a View in the XAF UI, use Actions, ShowViewInPopupWindow, ShowMessage, etc. Refer to the following topic for details: Ways to Show a View.

See Also

Ways to Show a View