NSControl.Activated vs. partial actions from the XIB

I've recently discovered that it doesn't seem possible to be able to react to an event in an NSControl (such as NSButton) if both an Activated event handler is defined and a partial action defined in the XIB file.

After looking at the implementation of what Xamarin.Mac does for the Activated event that is defined on NSControl, it will seem to override the sent action defined in the XIB file. This is fine - but it prevents wiring up events in Xcode, meaning they have to be defined in code, via the Activated event. There are plusses and minuses for this, but that's not what I want to go in to.

I am wondering what others do for wiring up events - do you use the Activated event handler or do you wire up events in Xcode, like you would in Objective-C, and fill in the partial code? Example:

Activated += delegate(object sender, EventArgs e) {


// in Moo.designer.cs
[Action ("ClickButton:")]
partial void ClickButton(NSObject sender);

// in Moo.cs
partial void ClickButton(NSObject sender) {
Sign In or Register to comment.