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