title: Xamarin forms: How to add SwipeGestureRecognizer for StackLayout?
body: <p>I have 15 options on my home page. Initially, I will show 9 options in UI. To view the remaining 6 icons, the user slides to the right and back to the left to see previous. I try to implement the swiping feature like below, but it is not working.</p>
  
  <p><strong>XAML</strong></p>
  
  <pre><code>&lt;StackLayout x:Name="firstLlayout"&gt;
      &lt;Grid&gt;
          //3 icons in horizontal
      &lt;/Grid&gt;
  
      &lt;Grid&gt;
          //3 icons in horizontal
      &lt;/Grid&gt;
  
      &lt;Grid&gt;
          //3 icons in horizontal
      &lt;/Grid&gt;
      &lt;StackLayout.GestureRecognizers&gt;
          &lt;SwipeGestureRecognizer Direction="Right" Swiped="RightSwipe"/&gt;
      &lt;/StackLayout.GestureRecognizers&gt;
  &lt;/StackLayout&gt;
  
  &lt;StackLayout IsVisible="False" x:Name="secondLayout"&gt;
       &lt;Grid&gt;
          //3 icons in horizontal
      &lt;/Grid&gt;
  
      &lt;Grid&gt;
          //3 icons in horizontal
      &lt;/Grid&gt;
      &lt;StackLayout.GestureRecognizers&gt;
          &lt;SwipeGestureRecognizer Direction="Left" Swiped="LeftSwipe"/&gt;
      &lt;/StackLayout.GestureRecognizers&gt;
  &lt;/StackLayout&gt;
  </code></pre>
  
  <p><strong>XAML.CS</strong></p>
  
  <pre><code>public void RightSwipe(object sender, EventArgs e)
  {
      firstLlayout.IsVisible = false;
      secondLayout.IsVisible = true;
  }
  
  public void LeftSwipe(object sender, EventArgs e)
  {
      secondLayout.IsVisible = false;
      firstLlayout.IsVisible = true;
  }
  </code></pre>
  
  <p>When try left and right swipe nothing is happening in UI, and code execution not coming to event functions. What I am missing here?</p>