Skip to main content
All docs
V24.2
.NET 8.0+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

XAF0022: Avoid using the ShowViewStrategy.ShowView method

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

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

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