Bug 36715 - NSDatePicker.ValidateProposedDateValue cannot take more than one event
Summary: NSDatePicker.ValidateProposedDateValue cannot take more than one event
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: 2.4.0 (C6)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Chris Hamons
Depends on:
Reported: 2015-12-08 15:29 UTC by marc
Modified: 2015-12-08 16:04 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description marc 2015-12-08 15:29:57 UTC
I created a NSDatePicker and added two delegates as handlers.
The first delegate was overridden by the second.

Normally (using a Multicast-Delegate), the first handler is set to the Target/Method properties which are derived from Delegate. Adding another handler, the Target/Method properties are cleared and the delegates collection (member of Multicast-Delegate) is used to hold the references to the handlers.
But this is not happening in this case. Target/Method are just overridden.
Comment 1 Chris Hamons 2015-12-08 15:48:43 UTC
Unfortunately, this is unfixable by design (by Apple). We're just exposing the underlying platform here.

The underlying delegate selector only accepts one instance. You can confirm this in objective-c with Xcode. 

This also means that if you have to choose between using our C# wrapper events and the actual delegate (since the events are implemented by assigning our own delegate).
Comment 2 marc 2015-12-08 15:53:22 UTC
Ah okay, thanks for making this point clear!

A wrapper class, deriving from NSDatePicker, and exposing a new Multicast-Delegate seems to be a good workaround (connecting the ValidateProposedDateValue event).
Comment 3 Chris Hamons 2015-12-08 16:04:48 UTC
Yep. Things like that are often needed to work around limitations in Cocoa.

Good luck!