xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

On Android, Button.Released event does not fire in ContentView if placed inside a TableView and finger is released outside of the button [Bug] #15769

Open janne-hmp opened 1 year ago

janne-hmp commented 1 year ago

Description

I've made a custom image button using ContentView as follows (see the attached zip), see also CustomImageButton at:

https://github.com/hyvanmielenpelit/GnollHack/tree/master/win/win32/winclisrv/GnollHackClient/GnollHackClient/Controls

CustomImageButton.zip

It works fine otherwise, but on Android when I put it inside a TableView, Button.Release event does not fire if I drag the finger outside of the button before releasing. On iOS it works just fine, and also if I release the finger inside the button. Something to do with TableView on Android clearly.

Steps to Reproduce

  1. Include the CustomImageButton custom control in your project or copy GnollHack repository
  2. Put the CustomImageButton inside a TableView. In GnollHack, you can change UseVaryingBackgroundImages property on one of the buttons on AboutPage's table view to True.
  3. Compile the project on Android.
  4. Hold down the button (the image changes due to being pressed) and then drag your finger outside of the button and release. The image does not change back. If you do this and release the finger inside the button, it works.

Expected Behavior

On Android, CustomImageButton changes bitmap when the finger is released outside of the button.

Actual Behavior

On Android, CustomImageButton does not change the bitmap on released event if the finger was outside of the button. (iOS is ok, and also if the finger was inside the button when released, or if the button is not inside a TableView.)

Basic Information

Environment

Show/Hide Visual Studio info ``` Microsoft Visual Studio Community 2022 Version 17.6.3 VisualStudio.17.Release/17.6.3+33801.468 Microsoft .NET Framework Version 4.8.09032 Installed Version: Community Visual C++ 2022 00482-90000-00000-AA350 Microsoft Visual C++ 2022 ASP.NET and Web Tools 17.6.326.62524 ASP.NET and Web Tools Azure App Service Tools v3.0.0 17.6.326.62524 Azure App Service Tools v3.0.0 Azure Functions and Web Jobs Tools 17.6.326.62524 Azure Functions and Web Jobs Tools C# Tools 4.6.0-3.23259.8+c3cc1d0ceeab1a65da0217e403851a1e8a30086a C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools. Extensibility Message Bus 1.4.21 (main@8f226a8) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration. Linux Core Dump Debugging 1.0.9.33801 Enables debugging of Linux core dumps. Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines Mono Debugging for Visual Studio 17.6.41 (790a401) Support for debugging Mono processes with Visual Studio. NuGet Package Manager 6.6.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/ Razor (ASP.NET Core) 17.6.0.2327201+a6a61fdfa748eaa65aab53dab583276e26af4a3e Provides languages services for ASP.NET Core Razor. SQL Server Data Tools 17.6.13.0 Microsoft SQL Server Data Tools Test Adapter for Boost.Test 1.0 Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory. Test Adapter for Google Test 1.0 Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory. TypeScript Tools 17.0.20329.2001 TypeScript Tools for Microsoft Visual Studio Visual Basic Tools 4.6.0-3.23259.8+c3cc1d0ceeab1a65da0217e403851a1e8a30086a Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. Visual C++ for Cross Platform Mobile Development (Android) 17.0.33606.364 Visual C++ for Cross Platform Mobile Development (Android) Visual C++ for Cross Platform Mobile Development (iOS) 17.0.33606.225 Visual C++ for Cross Platform Mobile Development (iOS) Visual C++ for Linux Development 1.0.9.33801 Visual C++ for Linux Development Visual F# Tools 17.6.0-beta.23174.5+0207bea1afae48d9351ac26fb51afc8260de0a97 Microsoft Visual F# Tools Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio. VisualStudio.DeviceLog 1.0 Information about my package VisualStudio.Mac 1.0 Mac Extension for Visual Studio VSPackage Extension 1.0 VSPackage Visual Studio Extension Detailed Info Xamarin 17.6.0.251 (d17-6@318364c) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android. Xamarin Designer 17.6.6.0 (remotes/origin/d17-6@cb430751d1) Visual Studio extension to enable Xamarin Designer tools in Visual Studio. Xamarin Templates 17.6.32 (98c12a2) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms. Xamarin.Android SDK 13.2.0.6 (d17-5/a200af1) Xamarin.Android Reference Assemblies and MSBuild support. Mono: 6dd9def Java.Interop: xamarin/java.interop/d17-5@149d70fe SQLite: xamarin/sqlite/3.40.1@68c69d8 Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@9f02d77 Xamarin.iOS and Xamarin.Mac SDK 16.4.0.6 (97731c92c) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support. ```

Build Logs

Screenshots

Reproduction Link

Workaround

Not found, just using currently non-changing bitmaps, but this is not ideal.