Button right click/two finger click event

1 Answer 947 Views
Button
Allen
Top achievements
Rank 1
Iron
Iron
Allen asked on 25 Mar 2022, 01:31 AM

Hi Team,

Do you implement right click event or two finger click event, three finger click event right now? I did not find docs about them.

If not, do you have a plan to implement it?

 

 

Thanks

 

1 Answer, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 25 Mar 2022, 12:45 PM

Hi Allen,

This is something that usually needs to be implemented by the framework. IN Xamarin/MAUI a "right-click" doesn't really exist, it is more commonly referred to as a "Long press" gesture.

Take a look at the TapGestureRecognizer Recognize a tap gesture - .NET MAUI | Microsoft Docs for the currently available options:

Other Options

Outside of what is already available, here are some topics you can look into.

1) Here is a link to a StackOverflow answer that explains using a behavior, attached to a Button https://stackoverflow.com/a/51247520/1406210 

even though the post if for Xamarin.Forms, the concept is the same for MAUI. IN fact, if you review the official Feature Request in Xamarin.Forms, Microsoft closed it stating that it will not make it into Xamarin.Forms, but should make it into MAUI https://github.com/xamarin/Xamarin.Forms/issues/3480 

2) I would also recommend checking out the next answer on using XLabs to differentiate between specific click types https://stackoverflow.com/a/44353203/1406210 

You might have to dig deeper to see if the XLabs stuff has been ported to MAUI yet. If it hasn't you will likely have to take their code and use it directly in your MAUI project.

3) Implementing your own platform-specific code

Here is a great post from Alex dunn on how to implement long press in Xamarin.Forms via the use of a Platform Effect Xamarin.Tip – Xamarin.Forms Long Press Effect – Alex Dunn

In MAUI, defining platform-specific code has gotten easier. you can take what you've learned form Alex's tutorial and implement it in your own classes created after following the Microsoft guidance .NET MAUI invoking platform code - .NET MAUI | Microsoft Docs

Feature Request

It sounds like you're talking about Mac trackpad gesture, I would recommend you take this early opportunity to bring it up as a feature request/enhancement to the Microsoft team in the .NET MAUI repository.

You can open a new Issue here, and ask them to implement any missing features Issues · dotnet/maui (github.com)

Regards,
Lance | Manager Technical Support
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Button
Asked by
Allen
Top achievements
Rank 1
Iron
Iron
Answers by
Lance | Manager Technical Support
Telerik team
Share this question
or