xamarin/Xamarin.Forms

Long Pressed Effect cannot be applied to ViewCell

Open

#7,501 opened on Sep 13, 2019

 (6 comments) (0 reactions) (0 assignees)C# (1,926 forks)batch import
a/gestures 🖖a/listviewe/7 :clock7:help wantedp/Androidpartner/cat 😻t/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Description

I have discussed this with David Ortinau about this request. I have a customer who's trying to implement a long pressed event on a ListView's ViewCell or its inside control such as StackLayout or Grid. David provided a link that I followed before: here is the link David thought if this is not working, then might be a bug with Xamarin.Forms, hence here is the issue to identify whether this is a bug or whether I am doing it wrongly. I have implemented the same and got 2 issues described as below:

  1. If I apply this effect to ViewCell element, it's not working at all. The ViewCell just remain its own feature.
  2. If I apply this effect to ViewCell's child element, in my case, it's StackLayout, the LongPressedEffect is working, but the ViewCell has lost all its original feature such as TappedEvent.

If there is a correct approach to implement this, please do let me know because customer is eager to have the answer for this issue.

Steps to Reproduce

  1. Download my sample project from: Project here
  2. Run the sample project and it's currently applied to the ViewCell.
  3. You will see that the Effect is not working at all.

Expected Behavior

The ViewCell can respond to the LongPressedEffect and remain its own original features. Also, customer wants to know if this eventually needs technology such as Custom Renderer, whether it can connects with .NET Standard project which means that implement a Long Pressed Event to bind with some control?

Actual Behavior

  1. If I apply this effect to ViewCell element, it's not working at all. The ViewCell just remain its own feature.
  2. If I apply this effect to ViewCell's child element, in my case, it's StackLayout, the LongPressedEffect is working, but the ViewCell has lost all its original feature such as TappedEvent.

Basic Information

  • Version with issue: Latest version of Xamarin.Forms.
  • Last known good version: None.
  • IDE: Visual Studio 2019
  • Platform Target Frameworks:
    • Android: Android 8+
  • Android Support Library Version: 28.0.0.1

Screenshots

No, just run the app and you will see.

Reproduction Link

Project here

Contributor guide