Xamarin (Frame.)GestureRecognizers doesn't work









up vote
4
down vote

favorite












I am trying to make a TapGestureRecognizer on some frames, but when I test it, nothing happens.



xaml



<StackLayout>
<AbsoluteLayout>
<Frame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" TranslationY="380" TranslationX="12.5" HeightRequest="60" WidthRequest="120">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Sport_Clicked"/>
</Frame.GestureRecognizers>
<StackLayout Orientation="Vertical" Padding="0" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Horizontal" Spacing="-10">
<Label Text="Sport" FontSize="17"/>
</StackLayout>
</StackLayout>
</Frame>

<Frame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" TranslationY="380" TranslationX="187.5" HeightRequest="60" WidthRequest="120">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Voeding_Clicked"/>
</Frame.GestureRecognizers>

<StackLayout Orientation="Vertical" Padding="0" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Horizontal" Spacing="-10">
<Label Text="Voeding" FontSize="17"/>
</StackLayout>
</StackLayout>
</Frame>

<Frame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" TranslationY="495" TranslationX="12.5" HeightRequest="60" WidthRequest="120">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Slaap_Clicked"/>
</Frame.GestureRecognizers>
<StackLayout Orientation="Vertical" Padding="0" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Horizontal" Spacing="-10">
<Label Text="Slaap" FontSize="17" />
</StackLayout>
</StackLayout>
</Frame>
</AbsoluteLayout>
</StackLayout>


cs



void Sport_Clicked(object sender, EventArgs e)

new NavigationPage(new SportPage());


void Voeding_Clicked(object sender, EventArgs e)

new NavigationPage(new VoedingPage());


void Slaap_Clicked(object sender, EventArgs e)

new NavigationPage(new SlaapPage());



I am not getting any warnings or errors when testing. Is there something that overlaps the frames which you cannot see that causes to blocks the input?



Edit:



This is how a frame looks with the following code



<Frame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" TranslationY="380" TranslationX="187.5" HeightRequest="60" WidthRequest="120" BackgroundColor="Yellow">
<StackLayout Orientation="Vertical" Padding="0" HorizontalOptions="FillAndExpand" BackgroundColor="Green">
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Tapped="Voeding_Clicked"/>
</StackLayout.GestureRecognizers>
<StackLayout Orientation="Horizontal" Spacing="-10" BackgroundColor="Red">
<Label Text="Voeding" FontSize="17"/>
</StackLayout>
</StackLayout>
</Frame>


image



With this code I should be able to click the green part and get a response, but I'm not getting that? Is there a way to have something that will overlap the whole frame so I can use that to click on?










share|improve this question























  • The contents of the frame would overlap it of course, either move it the StackLayout or add it to the stacklayout and keep both (if you have large margins/paddings that would improve the total touch area....)
    – SushiHangover
    Nov 9 at 22:23










  • Like this? pastebin.com/04SU59HG. This also didn't work.
    – Jip Harthoorn
    Nov 9 at 22:49










  • If you have the Xamarin Inspector (enterprise license) you can see if something is overlapping and blocking touch input docs.microsoft.com/en-us/xamarin/tools/inspector Otherwise you can assign different background colors to the controls and do it that way....
    – SushiHangover
    Nov 9 at 23:00











  • Please see the edited post. I have no Xamarin Inspector.
    – Jip Harthoorn
    Nov 9 at 23:13










  • Anyone an idea?
    – Jip Harthoorn
    Nov 11 at 16:05














up vote
4
down vote

favorite












I am trying to make a TapGestureRecognizer on some frames, but when I test it, nothing happens.



xaml



<StackLayout>
<AbsoluteLayout>
<Frame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" TranslationY="380" TranslationX="12.5" HeightRequest="60" WidthRequest="120">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Sport_Clicked"/>
</Frame.GestureRecognizers>
<StackLayout Orientation="Vertical" Padding="0" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Horizontal" Spacing="-10">
<Label Text="Sport" FontSize="17"/>
</StackLayout>
</StackLayout>
</Frame>

<Frame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" TranslationY="380" TranslationX="187.5" HeightRequest="60" WidthRequest="120">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Voeding_Clicked"/>
</Frame.GestureRecognizers>

<StackLayout Orientation="Vertical" Padding="0" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Horizontal" Spacing="-10">
<Label Text="Voeding" FontSize="17"/>
</StackLayout>
</StackLayout>
</Frame>

<Frame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" TranslationY="495" TranslationX="12.5" HeightRequest="60" WidthRequest="120">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Slaap_Clicked"/>
</Frame.GestureRecognizers>
<StackLayout Orientation="Vertical" Padding="0" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Horizontal" Spacing="-10">
<Label Text="Slaap" FontSize="17" />
</StackLayout>
</StackLayout>
</Frame>
</AbsoluteLayout>
</StackLayout>


cs



void Sport_Clicked(object sender, EventArgs e)

new NavigationPage(new SportPage());


void Voeding_Clicked(object sender, EventArgs e)

new NavigationPage(new VoedingPage());


void Slaap_Clicked(object sender, EventArgs e)

new NavigationPage(new SlaapPage());



I am not getting any warnings or errors when testing. Is there something that overlaps the frames which you cannot see that causes to blocks the input?



Edit:



This is how a frame looks with the following code



<Frame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" TranslationY="380" TranslationX="187.5" HeightRequest="60" WidthRequest="120" BackgroundColor="Yellow">
<StackLayout Orientation="Vertical" Padding="0" HorizontalOptions="FillAndExpand" BackgroundColor="Green">
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Tapped="Voeding_Clicked"/>
</StackLayout.GestureRecognizers>
<StackLayout Orientation="Horizontal" Spacing="-10" BackgroundColor="Red">
<Label Text="Voeding" FontSize="17"/>
</StackLayout>
</StackLayout>
</Frame>


image



With this code I should be able to click the green part and get a response, but I'm not getting that? Is there a way to have something that will overlap the whole frame so I can use that to click on?










share|improve this question























  • The contents of the frame would overlap it of course, either move it the StackLayout or add it to the stacklayout and keep both (if you have large margins/paddings that would improve the total touch area....)
    – SushiHangover
    Nov 9 at 22:23










  • Like this? pastebin.com/04SU59HG. This also didn't work.
    – Jip Harthoorn
    Nov 9 at 22:49










  • If you have the Xamarin Inspector (enterprise license) you can see if something is overlapping and blocking touch input docs.microsoft.com/en-us/xamarin/tools/inspector Otherwise you can assign different background colors to the controls and do it that way....
    – SushiHangover
    Nov 9 at 23:00











  • Please see the edited post. I have no Xamarin Inspector.
    – Jip Harthoorn
    Nov 9 at 23:13










  • Anyone an idea?
    – Jip Harthoorn
    Nov 11 at 16:05












up vote
4
down vote

favorite









up vote
4
down vote

favorite











I am trying to make a TapGestureRecognizer on some frames, but when I test it, nothing happens.



xaml



<StackLayout>
<AbsoluteLayout>
<Frame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" TranslationY="380" TranslationX="12.5" HeightRequest="60" WidthRequest="120">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Sport_Clicked"/>
</Frame.GestureRecognizers>
<StackLayout Orientation="Vertical" Padding="0" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Horizontal" Spacing="-10">
<Label Text="Sport" FontSize="17"/>
</StackLayout>
</StackLayout>
</Frame>

<Frame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" TranslationY="380" TranslationX="187.5" HeightRequest="60" WidthRequest="120">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Voeding_Clicked"/>
</Frame.GestureRecognizers>

<StackLayout Orientation="Vertical" Padding="0" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Horizontal" Spacing="-10">
<Label Text="Voeding" FontSize="17"/>
</StackLayout>
</StackLayout>
</Frame>

<Frame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" TranslationY="495" TranslationX="12.5" HeightRequest="60" WidthRequest="120">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Slaap_Clicked"/>
</Frame.GestureRecognizers>
<StackLayout Orientation="Vertical" Padding="0" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Horizontal" Spacing="-10">
<Label Text="Slaap" FontSize="17" />
</StackLayout>
</StackLayout>
</Frame>
</AbsoluteLayout>
</StackLayout>


cs



void Sport_Clicked(object sender, EventArgs e)

new NavigationPage(new SportPage());


void Voeding_Clicked(object sender, EventArgs e)

new NavigationPage(new VoedingPage());


void Slaap_Clicked(object sender, EventArgs e)

new NavigationPage(new SlaapPage());



I am not getting any warnings or errors when testing. Is there something that overlaps the frames which you cannot see that causes to blocks the input?



Edit:



This is how a frame looks with the following code



<Frame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" TranslationY="380" TranslationX="187.5" HeightRequest="60" WidthRequest="120" BackgroundColor="Yellow">
<StackLayout Orientation="Vertical" Padding="0" HorizontalOptions="FillAndExpand" BackgroundColor="Green">
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Tapped="Voeding_Clicked"/>
</StackLayout.GestureRecognizers>
<StackLayout Orientation="Horizontal" Spacing="-10" BackgroundColor="Red">
<Label Text="Voeding" FontSize="17"/>
</StackLayout>
</StackLayout>
</Frame>


image



With this code I should be able to click the green part and get a response, but I'm not getting that? Is there a way to have something that will overlap the whole frame so I can use that to click on?










share|improve this question















I am trying to make a TapGestureRecognizer on some frames, but when I test it, nothing happens.



xaml



<StackLayout>
<AbsoluteLayout>
<Frame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" TranslationY="380" TranslationX="12.5" HeightRequest="60" WidthRequest="120">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Sport_Clicked"/>
</Frame.GestureRecognizers>
<StackLayout Orientation="Vertical" Padding="0" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Horizontal" Spacing="-10">
<Label Text="Sport" FontSize="17"/>
</StackLayout>
</StackLayout>
</Frame>

<Frame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" TranslationY="380" TranslationX="187.5" HeightRequest="60" WidthRequest="120">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Voeding_Clicked"/>
</Frame.GestureRecognizers>

<StackLayout Orientation="Vertical" Padding="0" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Horizontal" Spacing="-10">
<Label Text="Voeding" FontSize="17"/>
</StackLayout>
</StackLayout>
</Frame>

<Frame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" TranslationY="495" TranslationX="12.5" HeightRequest="60" WidthRequest="120">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Slaap_Clicked"/>
</Frame.GestureRecognizers>
<StackLayout Orientation="Vertical" Padding="0" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Horizontal" Spacing="-10">
<Label Text="Slaap" FontSize="17" />
</StackLayout>
</StackLayout>
</Frame>
</AbsoluteLayout>
</StackLayout>


cs



void Sport_Clicked(object sender, EventArgs e)

new NavigationPage(new SportPage());


void Voeding_Clicked(object sender, EventArgs e)

new NavigationPage(new VoedingPage());


void Slaap_Clicked(object sender, EventArgs e)

new NavigationPage(new SlaapPage());



I am not getting any warnings or errors when testing. Is there something that overlaps the frames which you cannot see that causes to blocks the input?



Edit:



This is how a frame looks with the following code



<Frame HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" TranslationY="380" TranslationX="187.5" HeightRequest="60" WidthRequest="120" BackgroundColor="Yellow">
<StackLayout Orientation="Vertical" Padding="0" HorizontalOptions="FillAndExpand" BackgroundColor="Green">
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Tapped="Voeding_Clicked"/>
</StackLayout.GestureRecognizers>
<StackLayout Orientation="Horizontal" Spacing="-10" BackgroundColor="Red">
<Label Text="Voeding" FontSize="17"/>
</StackLayout>
</StackLayout>
</Frame>


image



With this code I should be able to click the green part and get a response, but I'm not getting that? Is there a way to have something that will overlap the whole frame so I can use that to click on?







xaml xamarin






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 23:26









Andy

6,57432465




6,57432465










asked Nov 9 at 21:59









Jip Harthoorn

918




918











  • The contents of the frame would overlap it of course, either move it the StackLayout or add it to the stacklayout and keep both (if you have large margins/paddings that would improve the total touch area....)
    – SushiHangover
    Nov 9 at 22:23










  • Like this? pastebin.com/04SU59HG. This also didn't work.
    – Jip Harthoorn
    Nov 9 at 22:49










  • If you have the Xamarin Inspector (enterprise license) you can see if something is overlapping and blocking touch input docs.microsoft.com/en-us/xamarin/tools/inspector Otherwise you can assign different background colors to the controls and do it that way....
    – SushiHangover
    Nov 9 at 23:00











  • Please see the edited post. I have no Xamarin Inspector.
    – Jip Harthoorn
    Nov 9 at 23:13










  • Anyone an idea?
    – Jip Harthoorn
    Nov 11 at 16:05
















  • The contents of the frame would overlap it of course, either move it the StackLayout or add it to the stacklayout and keep both (if you have large margins/paddings that would improve the total touch area....)
    – SushiHangover
    Nov 9 at 22:23










  • Like this? pastebin.com/04SU59HG. This also didn't work.
    – Jip Harthoorn
    Nov 9 at 22:49










  • If you have the Xamarin Inspector (enterprise license) you can see if something is overlapping and blocking touch input docs.microsoft.com/en-us/xamarin/tools/inspector Otherwise you can assign different background colors to the controls and do it that way....
    – SushiHangover
    Nov 9 at 23:00











  • Please see the edited post. I have no Xamarin Inspector.
    – Jip Harthoorn
    Nov 9 at 23:13










  • Anyone an idea?
    – Jip Harthoorn
    Nov 11 at 16:05















The contents of the frame would overlap it of course, either move it the StackLayout or add it to the stacklayout and keep both (if you have large margins/paddings that would improve the total touch area....)
– SushiHangover
Nov 9 at 22:23




The contents of the frame would overlap it of course, either move it the StackLayout or add it to the stacklayout and keep both (if you have large margins/paddings that would improve the total touch area....)
– SushiHangover
Nov 9 at 22:23












Like this? pastebin.com/04SU59HG. This also didn't work.
– Jip Harthoorn
Nov 9 at 22:49




Like this? pastebin.com/04SU59HG. This also didn't work.
– Jip Harthoorn
Nov 9 at 22:49












If you have the Xamarin Inspector (enterprise license) you can see if something is overlapping and blocking touch input docs.microsoft.com/en-us/xamarin/tools/inspector Otherwise you can assign different background colors to the controls and do it that way....
– SushiHangover
Nov 9 at 23:00





If you have the Xamarin Inspector (enterprise license) you can see if something is overlapping and blocking touch input docs.microsoft.com/en-us/xamarin/tools/inspector Otherwise you can assign different background colors to the controls and do it that way....
– SushiHangover
Nov 9 at 23:00













Please see the edited post. I have no Xamarin Inspector.
– Jip Harthoorn
Nov 9 at 23:13




Please see the edited post. I have no Xamarin Inspector.
– Jip Harthoorn
Nov 9 at 23:13












Anyone an idea?
– Jip Harthoorn
Nov 11 at 16:05




Anyone an idea?
– Jip Harthoorn
Nov 11 at 16:05












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










Cause:



Your Frame doesn't respond to your TapGestureRecognizer is caused by your TranslationY="380" TranslationX="187.5" properies. You cannot tap on the control that is out of bounds of parent view, even if this control is seen.




Translating an element outside the bounds of its parent container may
prevent inputs from working.




Solution:



Remove the TranslationY and TranslationX properties and layout your Frame in other ways.



Edited:



You can see the screenshort below, I write a simple demo and add PaleGreen as AbsoluteLayout's backgroundColor. Your Frame is out of bounds of parent view.So it will not do response to TapGestureRecognizer.



So, set FillAndExpand to AbsoluteLayout's VerticalOptions property to make sure your Frame is inside the bounds of parent view.



<AbsoluteLayout BackgroundColor="PaleGreen" VerticalOptions="FillAndExpand">


I updated a screenshot here,hope you can understand well:



subViewOutOfParentView






share|improve this answer






















  • Thanks for the reply. I now go the Frame at the right position using Margin, but I don't know how to place the GestureRecognizer so that it overlaps the whole frame. How should I do that, because at the moment I still doesn't respond.
    – Jip Harthoorn
    Nov 12 at 17:51










  • @JipHarthoorn See my edit, reply me if you have any question.
    – Jack Hua - MSFT
    Nov 13 at 2:02










  • Thanks. I am now using this code pastebin.com/JXfPsukB I added FillAndExpand and palegreen color and this is the result i.gyazo.com/2c423f46d4b3ef1ecadc966020b95e42.jpg. However, still nothing happens when I click anything.
    – Jip Harthoorn
    Nov 13 at 8:52










  • I just copy your code and add a breakpoint in Sport_Clicked. It really entry the function and works well. Is there any other code?
    – Jack Hua - MSFT
    Nov 13 at 9:02






  • 1




    I tested again and it really worked. Can you please create a new project and add your codes of Frame to test again? And add a breakpoint to the tap function in code benhind.
    – Jack Hua - MSFT
    Nov 14 at 1:54










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233789%2fxamarin-frame-gesturerecognizers-doesnt-work%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










Cause:



Your Frame doesn't respond to your TapGestureRecognizer is caused by your TranslationY="380" TranslationX="187.5" properies. You cannot tap on the control that is out of bounds of parent view, even if this control is seen.




Translating an element outside the bounds of its parent container may
prevent inputs from working.




Solution:



Remove the TranslationY and TranslationX properties and layout your Frame in other ways.



Edited:



You can see the screenshort below, I write a simple demo and add PaleGreen as AbsoluteLayout's backgroundColor. Your Frame is out of bounds of parent view.So it will not do response to TapGestureRecognizer.



So, set FillAndExpand to AbsoluteLayout's VerticalOptions property to make sure your Frame is inside the bounds of parent view.



<AbsoluteLayout BackgroundColor="PaleGreen" VerticalOptions="FillAndExpand">


I updated a screenshot here,hope you can understand well:



subViewOutOfParentView






share|improve this answer






















  • Thanks for the reply. I now go the Frame at the right position using Margin, but I don't know how to place the GestureRecognizer so that it overlaps the whole frame. How should I do that, because at the moment I still doesn't respond.
    – Jip Harthoorn
    Nov 12 at 17:51










  • @JipHarthoorn See my edit, reply me if you have any question.
    – Jack Hua - MSFT
    Nov 13 at 2:02










  • Thanks. I am now using this code pastebin.com/JXfPsukB I added FillAndExpand and palegreen color and this is the result i.gyazo.com/2c423f46d4b3ef1ecadc966020b95e42.jpg. However, still nothing happens when I click anything.
    – Jip Harthoorn
    Nov 13 at 8:52










  • I just copy your code and add a breakpoint in Sport_Clicked. It really entry the function and works well. Is there any other code?
    – Jack Hua - MSFT
    Nov 13 at 9:02






  • 1




    I tested again and it really worked. Can you please create a new project and add your codes of Frame to test again? And add a breakpoint to the tap function in code benhind.
    – Jack Hua - MSFT
    Nov 14 at 1:54














up vote
1
down vote



accepted










Cause:



Your Frame doesn't respond to your TapGestureRecognizer is caused by your TranslationY="380" TranslationX="187.5" properies. You cannot tap on the control that is out of bounds of parent view, even if this control is seen.




Translating an element outside the bounds of its parent container may
prevent inputs from working.




Solution:



Remove the TranslationY and TranslationX properties and layout your Frame in other ways.



Edited:



You can see the screenshort below, I write a simple demo and add PaleGreen as AbsoluteLayout's backgroundColor. Your Frame is out of bounds of parent view.So it will not do response to TapGestureRecognizer.



So, set FillAndExpand to AbsoluteLayout's VerticalOptions property to make sure your Frame is inside the bounds of parent view.



<AbsoluteLayout BackgroundColor="PaleGreen" VerticalOptions="FillAndExpand">


I updated a screenshot here,hope you can understand well:



subViewOutOfParentView






share|improve this answer






















  • Thanks for the reply. I now go the Frame at the right position using Margin, but I don't know how to place the GestureRecognizer so that it overlaps the whole frame. How should I do that, because at the moment I still doesn't respond.
    – Jip Harthoorn
    Nov 12 at 17:51










  • @JipHarthoorn See my edit, reply me if you have any question.
    – Jack Hua - MSFT
    Nov 13 at 2:02










  • Thanks. I am now using this code pastebin.com/JXfPsukB I added FillAndExpand and palegreen color and this is the result i.gyazo.com/2c423f46d4b3ef1ecadc966020b95e42.jpg. However, still nothing happens when I click anything.
    – Jip Harthoorn
    Nov 13 at 8:52










  • I just copy your code and add a breakpoint in Sport_Clicked. It really entry the function and works well. Is there any other code?
    – Jack Hua - MSFT
    Nov 13 at 9:02






  • 1




    I tested again and it really worked. Can you please create a new project and add your codes of Frame to test again? And add a breakpoint to the tap function in code benhind.
    – Jack Hua - MSFT
    Nov 14 at 1:54












up vote
1
down vote



accepted







up vote
1
down vote



accepted






Cause:



Your Frame doesn't respond to your TapGestureRecognizer is caused by your TranslationY="380" TranslationX="187.5" properies. You cannot tap on the control that is out of bounds of parent view, even if this control is seen.




Translating an element outside the bounds of its parent container may
prevent inputs from working.




Solution:



Remove the TranslationY and TranslationX properties and layout your Frame in other ways.



Edited:



You can see the screenshort below, I write a simple demo and add PaleGreen as AbsoluteLayout's backgroundColor. Your Frame is out of bounds of parent view.So it will not do response to TapGestureRecognizer.



So, set FillAndExpand to AbsoluteLayout's VerticalOptions property to make sure your Frame is inside the bounds of parent view.



<AbsoluteLayout BackgroundColor="PaleGreen" VerticalOptions="FillAndExpand">


I updated a screenshot here,hope you can understand well:



subViewOutOfParentView






share|improve this answer














Cause:



Your Frame doesn't respond to your TapGestureRecognizer is caused by your TranslationY="380" TranslationX="187.5" properies. You cannot tap on the control that is out of bounds of parent view, even if this control is seen.




Translating an element outside the bounds of its parent container may
prevent inputs from working.




Solution:



Remove the TranslationY and TranslationX properties and layout your Frame in other ways.



Edited:



You can see the screenshort below, I write a simple demo and add PaleGreen as AbsoluteLayout's backgroundColor. Your Frame is out of bounds of parent view.So it will not do response to TapGestureRecognizer.



So, set FillAndExpand to AbsoluteLayout's VerticalOptions property to make sure your Frame is inside the bounds of parent view.



<AbsoluteLayout BackgroundColor="PaleGreen" VerticalOptions="FillAndExpand">


I updated a screenshot here,hope you can understand well:



subViewOutOfParentView







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 13 at 2:09

























answered Nov 12 at 2:52









Jack Hua - MSFT

5897




5897











  • Thanks for the reply. I now go the Frame at the right position using Margin, but I don't know how to place the GestureRecognizer so that it overlaps the whole frame. How should I do that, because at the moment I still doesn't respond.
    – Jip Harthoorn
    Nov 12 at 17:51










  • @JipHarthoorn See my edit, reply me if you have any question.
    – Jack Hua - MSFT
    Nov 13 at 2:02










  • Thanks. I am now using this code pastebin.com/JXfPsukB I added FillAndExpand and palegreen color and this is the result i.gyazo.com/2c423f46d4b3ef1ecadc966020b95e42.jpg. However, still nothing happens when I click anything.
    – Jip Harthoorn
    Nov 13 at 8:52










  • I just copy your code and add a breakpoint in Sport_Clicked. It really entry the function and works well. Is there any other code?
    – Jack Hua - MSFT
    Nov 13 at 9:02






  • 1




    I tested again and it really worked. Can you please create a new project and add your codes of Frame to test again? And add a breakpoint to the tap function in code benhind.
    – Jack Hua - MSFT
    Nov 14 at 1:54
















  • Thanks for the reply. I now go the Frame at the right position using Margin, but I don't know how to place the GestureRecognizer so that it overlaps the whole frame. How should I do that, because at the moment I still doesn't respond.
    – Jip Harthoorn
    Nov 12 at 17:51










  • @JipHarthoorn See my edit, reply me if you have any question.
    – Jack Hua - MSFT
    Nov 13 at 2:02










  • Thanks. I am now using this code pastebin.com/JXfPsukB I added FillAndExpand and palegreen color and this is the result i.gyazo.com/2c423f46d4b3ef1ecadc966020b95e42.jpg. However, still nothing happens when I click anything.
    – Jip Harthoorn
    Nov 13 at 8:52










  • I just copy your code and add a breakpoint in Sport_Clicked. It really entry the function and works well. Is there any other code?
    – Jack Hua - MSFT
    Nov 13 at 9:02






  • 1




    I tested again and it really worked. Can you please create a new project and add your codes of Frame to test again? And add a breakpoint to the tap function in code benhind.
    – Jack Hua - MSFT
    Nov 14 at 1:54















Thanks for the reply. I now go the Frame at the right position using Margin, but I don't know how to place the GestureRecognizer so that it overlaps the whole frame. How should I do that, because at the moment I still doesn't respond.
– Jip Harthoorn
Nov 12 at 17:51




Thanks for the reply. I now go the Frame at the right position using Margin, but I don't know how to place the GestureRecognizer so that it overlaps the whole frame. How should I do that, because at the moment I still doesn't respond.
– Jip Harthoorn
Nov 12 at 17:51












@JipHarthoorn See my edit, reply me if you have any question.
– Jack Hua - MSFT
Nov 13 at 2:02




@JipHarthoorn See my edit, reply me if you have any question.
– Jack Hua - MSFT
Nov 13 at 2:02












Thanks. I am now using this code pastebin.com/JXfPsukB I added FillAndExpand and palegreen color and this is the result i.gyazo.com/2c423f46d4b3ef1ecadc966020b95e42.jpg. However, still nothing happens when I click anything.
– Jip Harthoorn
Nov 13 at 8:52




Thanks. I am now using this code pastebin.com/JXfPsukB I added FillAndExpand and palegreen color and this is the result i.gyazo.com/2c423f46d4b3ef1ecadc966020b95e42.jpg. However, still nothing happens when I click anything.
– Jip Harthoorn
Nov 13 at 8:52












I just copy your code and add a breakpoint in Sport_Clicked. It really entry the function and works well. Is there any other code?
– Jack Hua - MSFT
Nov 13 at 9:02




I just copy your code and add a breakpoint in Sport_Clicked. It really entry the function and works well. Is there any other code?
– Jack Hua - MSFT
Nov 13 at 9:02




1




1




I tested again and it really worked. Can you please create a new project and add your codes of Frame to test again? And add a breakpoint to the tap function in code benhind.
– Jack Hua - MSFT
Nov 14 at 1:54




I tested again and it really worked. Can you please create a new project and add your codes of Frame to test again? And add a breakpoint to the tap function in code benhind.
– Jack Hua - MSFT
Nov 14 at 1:54

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233789%2fxamarin-frame-gesturerecognizers-doesnt-work%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

Museum of Modern and Contemporary Art of Trento and Rovereto