Search code examples
interface-buildermacosmonomac

How do I know when a control outlet has been set up in MonoMac?


Basically, in my application's initialization, I want to set the value of a control's property once it has been loaded. In MonoMac, it appears that when the MainWindowController's Initialize method is called, the control outlets are not necessarily available (they are null).

I couldn't find any events such as LoadComplete that I could listen on and then do the required initialization on my control.


Solution

  • You should use the AwakeFromNib method in your MainWindowController class. It is called once all the objects have been loaded and connected.

    public override void AwakeFromNib ()
    {
        base.AwakeFromNib ();
    
        // Do something here with the outlets
    }