title: Xamarin - Assigning UICollectionViewDelegate wipes out event handlers (and vice versa)
body: <p>I have a <code>UICollectionView</code> from which I need to listen to scrolling and selection events independently. I assign the <code>Delegate</code> and the <code>Scrolled</code> event handler as follows:</p>
  
  <pre><code>public override void ViewWillAppear(bool animated)
  (
      base.ViewWillAppear(animated);
      this.CollectionView.Delegate = this.CollectionViewDelegate;
      this.CollectionView.Scrolled += HandleCollectionViewScrolled;
  }
  </code></pre>
  
  <p>However, after I assign the event handler, the delegate methods no longer get called. And reversing them:</p>
  
  <pre><code>public override void ViewWillAppear(bool animated)
  (
      base.ViewWillAppear(animated);
      this.CollectionView.Scrolled += HandleCollectionViewScrolled;
      this.CollectionView.Delegate = this.CollectionViewDelegate;
  }
  </code></pre>
  
  <p>yields the exact opposite result (the delegate methods working but no scrolled listener).</p>
  
  <p>Thinking that the strongly typed delegate's necessary implementation of all methods might be wiping the event handlers out, I tried instead to assign the <code>WeakDelegate</code> property, which is an <code>NSObject</code> subclass that only implements <code>collectionView:didSelectItemAtIndexPath:</code>.</p>
  
  <pre><code>public class MyCollectionViewDelegate : NSObject
  {
      public MyCollectionViewDelegate() : base()
      {
      }
  
      [Export ("collectionView:didSelectItemAtIndexPath:")]
      public void ItemSelected(UICollectionView collectionView, MonoTouch.Foundation.NSIndexPath indexPath)
      {
          Console.WriteLine("It worked.");
      }
  }
  </code></pre>
  
  <p>But again, I get the same result: only the event handler or the delegate fires. Has anyone else experienced this? Is this an issue with Xamarin? I would expect that setting the weak delegate <em>shouldn't</em> necessarily wipe out the event handlers.</p>
  
  <p>It's also worth noting that as a workaround, I tried using KVO. But KVO crashes the app when I try to observe the <code>contentOffset</code> property of the collection view (perhaps I'm using the wrong key path name).</p>