Skip to main content
.NET 6.0+

ViewController Class

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v23.2.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public class ViewController :
    Controller

Remarks

A ViewController class is a descendant of the Controller class. Use it as an ancestor for a custom Controller which is intended to function with a View. View Controllers are registered within both a Window and Frame. You can access the parent Frame using the Controller.Frame property, and its View using the ViewController.View property. The Object Space used by the current View can be accessed via the protected ObjectSpace property. To implement custom code to be performed at runtime, use the Controller’s mechanisms for activation and deactivation, i.e., handle the Controller.Activated and Controller.Deactivated events.

You can specify the Views for which a View Controller will be activated. For this purpose, use the ViewController.TargetObjectType, ViewController.TargetViewId, ViewController.TargetViewNesting and ViewController.TargetViewType properties (see How do I specify in which View (form) a Controller should be activated). You can also prohibit Controller activation for a particular View by overriding the ViewController.OnViewChanging method.

Note

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.

If you need to implement features with Windows (e.g., customize a Window’s Template or View), use the WindowController class instead of ViewController.

Implements

See Also