Bug 15721 - UITableView.WillEndDragging causes TableSource.OnRowSelected to not work.
Summary: UITableView.WillEndDragging causes TableSource.OnRowSelected to not work.
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 6.4.4
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-10-25 21:09 UTC by Jon Goldberger [MSFT]
Modified: 2013-10-28 09:41 UTC (History)
3 users (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:

Comment 1 Jon Goldberger [MSFT] 2013-10-25 21:11:06 UTC
This solution has an error and do not know how to solve.....

I have this

public override void ViewDidLoad ()

base.ViewDidLoad ();
listaReceitas = new UITableView (View.Bounds);

listaReceitas.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin;

tableSource = new TableSource<Receita> ();
tableSource.OnRowSelected +=
(object sender, TableSource<Receita>.RowSelectedEventArgs e) => {
(receitaScreen == null) {
receitaScreen = new ReceitaScreen ();
receita = (Receita)tableSource.Data [e.indexPath.Row];

receitaScreen.Receita = receita;

NavigationController.PushViewController (receitaScreen, true);

listaReceitas.Source = tableSource;
listaReceitas.WillEndDragging +=
(object sender, WillEndDraggingEventArgs e) =>
var cells =

var last =
lastSource = tableSource.Data[tableSource.Data.Count -1].Nome;

== lastSource)

Add (listaReceitas);

// Perform any additional
setup after loading the view, typically from a nib.

If i have my
WillEndDragging the OnRowSelected down't work you know why ?
=== Xamarin Studio ===

Version 4.0.13 (build
Installation UUID: f7c234c6-a1a0-4e32-8483-eef7fe4f664f

Mono 3.2.3 ((no/8d3b4b7)
GTK+ 2.24.20 theme: Raleigh
GTK# (

Package version: 302030000

=== Apple Developer Tools ===

Xcode 5.0
Build 5A1413

=== Xamarin.Mac ===

Xamarin.Mac: Not

=== Xamarin.iOS ===

Version: (Enterprise
Hash: 57edee2
Build date: 2013-04-10 18:05:51-0400

=== Xamarin.Android ===

Version: 4.8.3 (Enterprise Edition)
SDK: /Users/Jaferreira/Library/Developer/Xamarin/android-sdk-mac_x86

Supported Android versions:
2.1 (API level 7)
2.2 (API level 8)
(API level 10)
3.1 (API level 12)
4.0 (API level 14)
4.0.3 (API level
Java SDK: /usr
java version "1.6.0_43"
Java(TM) SE Runtime
Environment (build 1.6.0_43-b01-447-11M4203)
Java HotSpot(TM) 64-Bit
Server VM (build 20.14-b01-447, mixed mode)

=== Build Information ===

Release ID: 400130038
Git revision:
Build date: 2013-09-24
Xamarin addins: 61140345a5b109633a94409edcbc7a4c19a425c6

=== Operating System ===

Mac OS X 10.8.5
MacBook-Pro-de-Joao.local 12.5.0 Darwin Kernel Version 12.5.0
Mon Jul
29 16:33:49 PDT 2013
root:xnu-2050.48.11~1/RELEASE_X86_64 x86_64
Comment 2 Rolf Bjarne Kvinge [MSFT] 2013-10-28 07:57:41 UTC
You can't mix Objective-C style delegates and .NET events.

.NET events are implemented internally using Objective-C style delegates, so attaching to events will remove any existing Obj-C style delegates (and those won't be called anymore), and setting the Obj-C style delegate will make any existing event handlers not work.

In this case UITableViewSource (which TableSource inherits from) acts as the Obj-C style delegate, so when a WillEndDragging handler is added to the listaReceitas table view, any previous delegates are removed.

The fix is simple: listen for WillEndDragging on the TableSource instance instead of on the listaReceitas instance:

tableSource.WillEndDragging += ....

More information can be found here: http://spouliot.wordpress.com/2012/03/26/events-vs-objective-c-delegates/
Comment 3 João Ferreira 2013-10-28 09:07:24 UTC

Thanks for the explanation!

But in the event WillEndDragging, as I know that has reached the end of the list? It's possible ? 

Comment 4 Rolf Bjarne Kvinge [MSFT] 2013-10-28 09:41:43 UTC
The WillEndDragging event will be raised exactly as before, the only thing you have to do is change the object you attach the handler to (tableSource instead of listaReceitas).