XafApplication.ControllersCreating Event
Occurs when XAF creates a frame and allows you to specify whether XAF should optimize the created Controllers.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v26.1.dll
Declaration
Event Data
The ControllersCreating event's data class is ControllersCreatingEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| FilterByView | Specifies whether to optimize the created controllers. |
| View | Returns the current View for the frame. |
Remarks
When XAF creates a frame, it instantiates only the Controllers required for the initial View. If the View type changes after the frame is created, XAF does not automatically create the Controllers required for the new View type. If a frame is expected to switch between different View types, set the FilterByView property to false to ensure the necessary Controllers are available.
using DevExpress.ExpressApp;
namespace SolutionName.Module.Controllers {
public class DisableOptimizationController : ViewController<DashboardView> {
protected override void OnActivated() {
base.OnActivated();
Application.ControllersCreating += Application_ControllersCreating;
}
protected override void OnDeactivated() {
Application.ControllersCreating -= Application_ControllersCreating;
base.OnDeactivated();
}
private void Application_ControllersCreating(object sender, ControllersCreatingEventArgs e) {
if (e.View.Id == "CustomObject_ListView") {
e.FilterByView = false;
}
}
}
}