The base class for Controllers.
NuGet Package: DevExpress.ExpressApp
Related API Members
The following members return Controller objects:
Controllers also serve as containers for Actions.
Controllers in XAF support dependency injection in .NET 6+ ASP.NET Core Blazor and Windows Forms applications.
To implement a Controller, inherit from the
Controller class or one of its descendants, such as:
- Used to implement custom features in nested or root Views
- Used to implement custom features in Windows.
Visual Studio Controller Template
To create a Controller with a Visual Studio template, right-click the Controllers folder in your XAF project and select Add DevExpress Item | New Item…. In the navigation pane of the invoked Template Gallery, choose XAF Controllers | View Controller or XAF Controllers | Window Controller.
Built-in Controller Customization
XAF supplies built-in Controllers to perform basic functions in ASP.NET Core Blazor, Windows Forms, and ASP.NET Web Forms applications. To customize the behavior of a particular Controller in code, inherit from it or subscribe to its events. For additional information, refer to the following topics:
XAF automatically instantiates public Controllers with public parameterless constructors.
Custom Code in Controllers
To provide custom code that XAF performs at runtime, use Controller’s activation and deactivation mechanisms.
To activate or deactivate a Controller, use the Controller.Active property.
To determine the current state of a Controller, use the Controller.Active property in a conditional expression. Alternatively, use the BoolList.ResultValue property of the object that the Controller.Active property returns.
To provide custom code that XAF executes each time a Controller is activated or deactivated, handle the Controller.Activated and Controller.Deactivated events or override the
To access a Controller’s Action collection in code, use the Controller.Actions property.