Skip to main content
.NET Standard 2.0+

Controller Class

The base class for Controllers.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v22.1.dll


public abstract class Controller :


Controllers are used to customize the program flow or implement end-user interaction. Controllers can execute custom code when their owner, Window or Frame, is created. They also serve as containers for Actions.

To implement a Controller, you should inherit from the Controller class or one of its descendants. Usually, the following Controller class descendants are used as ancestors for new Controllers: ViewController and WindowController. The ViewController class is used to implement custom features with Views (whether nested or root), the WindowController class - with Windows.

There is a Visual Studio template for Controller creation. Right-click the Controllers folder of an XAF project and select Add DevExpress Item | New Item… to invoke Template Gallery. Then choose XAF Controllers | View Controller or XAF Controllers | Window Controller.


CodeRush allows you to add Actions and Controllers with a few keystrokes. To learn about the Code Templates for XAF, refer to the following help topic: XAF Templates.

The eXpressApp Framework supplies a great many built-in Controllers to perform basic features in Windows Forms, ASP.NET Web Forms, and ASP.NET Core Blazor applications. If you need to customize the behavior of a particular Controller, inherit from it or subscribe to its events. To learn more, refer to the Controllers and Customize Controllers and Actions topics.

You can customize Controllers using the IModelControllers node in the Model Editor. Information on Controllers is represented by properties of the ActionDesign | Controllers | Controller nodes. These properties can be initially set to default values or the values that you specified in the Controller’s constructor, or in the Controller’s Designer. You can modify these values if the properties are not read-only.

You do not need to create Controllers, because all the Controllers defined in the Application Model are created automatically.

To provide custom code that will be performed at runtime, use the Controller activation and deactivation mechanisms. Use the Controller.Active property to activate and deactivate a Controller. Handle the Controller.Activated and Controller.Deactivated events, to provide custom code to be executed each time a Controller is activated or deactivated. To determine the current active state of a Controller, use the Controller.Active property in a conditional expression. Alternatively, use the BoolList.ResultValue property of the object returned by the Controller.Active property.

To add an Action to a Controller, use the Designer. To access a Controller’s Action collection in code, use the Controller.Actions property.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Controller class.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.


See Also