- Home
- Forum
- Xamarin.Forms
- Convert TouchInteractionEventArgs point value to a value relative to the width of the control
Convert TouchInteractionEventArgs point value to a value relative to the width of the control
Hello,
I want to know if a user tap in the left or in the right side of the control. The code I'm using is:
private void PdfViewer_OnTapped(object a_Sender, TouchInteractionEventArgs a_E)
{
bool? toLeft = null;
if (a_E.Position.X < Width * 0.3)
{
toLeft = false;
}
else if (a_E.Position.X > Width * 0.7)
{
toLeft = true;
}
}
But X value, if I tap on the right edge it's far greater than the Width. How can I transform Point values to map to Width and Height values?.
Or there is any way to get the maximum value TouchInteractionEventArgs.Point.X can have?
Greetings,
David
Based on your query we assumed that you are trying to find the left and right side of the control based on the tapped position. If your requirement is different from our understanding please provide more details and also to provide better solution please provide more details about your use case scenarios.
Regards,
Vikram
Yes, that its. If the user taps on the left side then the previous pdf will be loaded but if the user taps on the right side then the next pdf will be loaded.
Currently we are preparing sample based on your requirement to recognize the left and right side of the control using gesture recognizer. We will update the further details on October 11, 2021
Vikram
We are still working on the sample creation to achieve your requirement “Recognize the left and right side of the control using gesture recognizer ”. We will update the further details on October 13, 2021. We appreciate your patience until then.
Regards,
Vikram
We have created a sample as for your requirement “Recognize the left side and right side when we tap on the control ”. Please find the sample below,
Regards,
Vikram
- 5 Replies
- 2 Participants
-
DS David Sancho
- Oct 5, 2021 06:59 PM UTC
- Oct 13, 2021 02:25 PM UTC