Can I add Tap gesture to the Entry

Recerec78FG 61 Reputation points
2021-05-10T06:31:14.27+00:00

It's possible to add Tap gesture to the Entry?
This code works for Label but doesn't work for Entry:

var tapEntryRecognizer = new TapGestureRecognizer(); 
tapFocusEntryRecognizer.Tapped += async (s, e) => { Console.WriteLine("tapped"); }; 
tapEntry.GestureRecognizers.Add(tapFocusEntryRecognizer);
Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,325 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 72,251 Reputation points Microsoft Vendor
    2021-05-10T06:52:56.917+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    You can use Focused event to achieve it

    https://learn.microsoft.com/en-us/dotnet/api/xamarin.forms.visualelement.focused?view=xamarin-forms

       myEntry.Focused += async (s, e) => {   
         
       //add you code  
         
       };  
    

    Best Regards,

    Leon Lu


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful