Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 1, 2025

  • Analyze issue SwipeGesture is not working on a listview/CollectionView #16624 - SwipeGestureRecognizer not working on ListView/CollectionView on Android
  • Investigate related issues and comments (.NET MAUI GestureRecognizers not working on certain controls #8895, SwipeGestureRecognizer is not working #7403)
  • Review iOS implementation to understand how swipe works there (iOS uses ShouldRecognizeSimultaneously = true)
  • Analyze Android gesture handling architecture (GesturePlatformManager, InnerGestureListener, SwipeGestureHandler)
  • Identify root cause: TapAndPanGestureDetector.OnTouchEvent returns early when base.OnTouchEvent returns true, skipping EndScrolling call on ACTION_UP
  • Implement fix to ensure EndScrolling is always called on ACTION_UP
  • Add test case for reproducing and verifying the fix (Issue16624.xaml, Issue16624.xaml.cs, Issue16624.cs)
  • Build and verify code compiles
  • Run code review - passed
  • Run CodeQL security check - passed
  • Run unit tests - all 82 gesture-related tests pass
  • Address PR feedback: Use x:Name instead of FindByName for StatusLabel
Original prompt

This section details on the original issue you should resolve

<issue_title>SwipeGesture is not working on a listview/CollectionView</issue_title>
<issue_description>### Description

Related to #8895 I still have the issue for more than 1 year where SwipeGesture is not working on a listview. My goal is that a user can swipe to the left and the swipe event should be raised. But I can swipe as many times as I want, nothing happens. The swipe event is never raised.

Steps to Reproduce

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="MauiApp1.MainPage"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:MauiApp1">

    <ListView ItemsSource="{Binding Source={x:Static local:Bla.Instance}, Path=Items}">
        <ListView.GestureRecognizers>
            <SwipeGestureRecognizer Direction="Left" Swiped="SwipeGestureRecognizer_Swiped" />
        </ListView.GestureRecognizers>
    </ListView>

</ContentPage>
using System.Collections.ObjectModel;

namespace MauiApp1
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void SwipeGestureRecognizer_Swiped(object sender, SwipedEventArgs e)
        {
            var s = string.Empty; //Set a breakpoint on this line and it never get hit or do something else, still event is never raised
        }
    }

    public class Bla
    {
        public static Bla Instance { get; } = new Bla();

        public Bla()
        {
            for (int i = 0; i < 20; i++)
            {
                Items.Add($"Item {i}");
            }
        }

        public ObservableCollection<string> Items { get; } = new ObservableCollection<string>();

    }

}

Link to public reproduction project repository

Yes

Version with bug

7.0.49 (Edit: 01/02/2024 still bugged)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Pixel 5 - API 31

Did you find any workaround?

No response

Relevant log output

No response</issue_description>

Comments on the Issue (you are @copilot in this section)

@ We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our [Triage Process](https://github.com/dotnet/maui/blob/main/docs/TriageProcess.md). @ Same issue with **any scrollable** view like `CollectionView`. See below Screencast and according sample code [here](https://github.com/ericbrunner/TaskyApp.Maui.SingleProject/commit/47e50bf82d353318b9da1ddef6c53318c6d7c367) Related to: #7403

issue_scrollableview_no_lef_right_swipe

@ @GitOguz You confuse `SwipeView` with [SwipeGestureRecognizer](https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/gestures/swipe#create-a-swipegesturerecognizer) which are different things! @ Hi @Symbai. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.</comment_new>
<comment_new>@
Hi @Symbai. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload...

Custom agent used: issue-resolver
Specialized agent for investigating and resolving community-reported .NET MAUI issues through hands-on testing and implementation


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…ndroid

The bug was that TapAndPanGestureDetector.OnTouchEvent would return early when
base.OnTouchEvent returned true, skipping the EndScrolling call needed to
complete swipe gesture detection. Now EndScrolling is always called on ACTION_UP
regardless of whether the base gesture detector consumed the event.

Fixes #16624

Co-authored-by: jfversluis <[email protected]>
Copilot AI changed the title [WIP] Fix SwipeGesture not working on ListView [Android] Fix SwipeGestureRecognizer not firing on CollectionView/ListView Dec 1, 2025
Copilot AI requested a review from jfversluis December 1, 2025 09:26
Copilot finished work on behalf of jfversluis December 1, 2025 09:26
Copilot finished work on behalf of jfversluis December 1, 2025 09:40
@jfversluis
Copy link
Member

jfversluis commented Dec 1, 2025

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SwipeGesture is not working on a listview/CollectionView

2 participants