The requested page is not available for the requested platform. You are viewing the content for Default platform.

Controller.FrameAssigned Event

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

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v19.1.dll

Declaration

public event EventHandler FrameAssigned
Public Event FrameAssigned As EventHandler

Event Data

The FrameAssigned event handler receives an argument of the EventArgs type.

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