Skip to main content
.NET 8.0+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Controller.FrameAssigned Event

Occurs after a Frame (Window) has been assigned to a Controller.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.2.dll

NuGet Package: DevExpress.ExpressApp

#Declaration

public event EventHandler FrameAssigned

#Event Data

The FrameAssigned event's data class is EventArgs.

#Remarks

When the FrameAssigned is raised, all Controllers loaded to the Application Model are created, and their Controller.Frame property is initialized. However a View is not yet assigned to these Controllers. Handle this event to perform specific actions with the current Controller or its Frame. For instance, you can access another built-in or custom Controller using the Frame.GetController method. The following code demonstrates how to deactivate a standard Controller by handling the FrameAssigned event.

public partial class MyCustomController : ViewController {
   // ...
   private void MyCustomController_FrameAssigned(object sender, EventArgs e) {
      AboutInfoController controller = Frame.GetController<AboutInfoController>();
      if (controller != null) {
          controller.Active.SetItemValue("DisabledByMyCustomController", false);
      }
   }
}

To avoid possible null reference exceptions when accessing an existing Controller from your code, always ensure that the Frame.GetController<ControllerType> method result is not null when the XafApplication.OptimizedControllersCreation property is true.

To perform specific actions with a ViewController before it is activated, override the OnViewChanging or OnViewChanged method.

To perform specific actions with a WindowController before it is activated, override the OnWindowChanging method.

See Also