title: Dismiss Rg.Plugins.Popup on scroll down in Xamarin forms
body: <p>I am using <a href="https://github.com/rotorgames/Rg.Plugins.Popup/issues" rel="nofollow noreferrer">Rg.Plugins.Popup</a> plugin in my xamarin forms app. It is a nice plugin for modal dialogs. However, I am looking to dismiss the dialog when user scrolls down. (Most dialogs in iOS has this behavior of closing with scrolling down).</p>
  <p>XAML inside Popup page.</p>
  <p><strong>Option 1</strong></p>
  <pre><code> &lt;pages:PopupPage xmlns=&quot;http://xamarin.com/schemas/2014/forms&quot;
               xmlns:x=&quot;http://schemas.microsoft.com/winfx/2009/xaml&quot;
               xmlns:pages=&quot;clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup&quot;
               HasSystemPadding=&quot;True&quot;
               CloseWhenBackgroundIsClicked=&quot;False&quot;
               x:Name=&quot;MyPage&quot;
               x:Class=&quot;wQuran.Views.Today.PrayerTimesSettingsPopupPage&quot;&gt;
  &lt;Frame Style=&quot;{DynamicResource PopupFrame}&quot; VerticalOptions=&quot;FillAndExpand&quot; IsClippedToBounds=&quot;True&quot;&gt;
          &lt;Grid RowDefinitions=&quot;Auto,*&quot; Style=&quot;{DynamicResource BaseGrid}&quot;&gt;
              &lt;BoxView Grid.Row=&quot;0&quot; Style=&quot;{DynamicResource PopupTitleBoxView}&quot;/&gt;
              &lt;Grid Grid.Row=&quot;0&quot; ColumnDefinitions=&quot;*,30&quot; HeightRequest=&quot;40&quot; Padding=&quot;10&quot;&gt;
                  &lt;Label Grid.Column=&quot;0&quot; Text=&quot;{Binding Title}&quot; Style=&quot;{DynamicResource PopupTitleLabel}&quot;/&gt;
                  &lt;ImageButton Grid.Column=&quot;1&quot; Style=&quot;{DynamicResource DialogCloseImageButton}&quot; Command=&quot;{Binding CloseDialogCommand}&quot;/&gt;
              &lt;/Grid&gt;
          &lt;/Grid&gt;
      &lt;/Frame&gt;
  &lt;/pages:PopupPage&gt;
  </code></pre>
  <p><strong>Option 2.</strong>
  Updated XAML and added the Frame inside ScrollView</p>
  <pre><code>&lt;ScrollView Scrolled=&quot;ScrollView_Scrolled&quot;&gt;
  ....
  &lt;/ScrollView&gt;
  
  private void ScrollView_Scrolled(object sender, Xamarin.Forms.ScrolledEventArgs e)
          {
              if (e.ScrollY &gt; 100)
              {
                  itemViewModel.CloseDialogCommand.Execute(null);   
              }
          }
  </code></pre>
  <p>In option 1 I don't have the scroll, so the plug in works with default behavior, but I have no way to close the dialog in scroll.</p>
  <p>In option 2, I added the frame inside the scrollview to check for Y scroll and dismiss the dialog. The Scrolled event never fires. Additionally, I cannot close the dialog when clicking outside the modal.</p>
  <p>After all, my question is how to dismiss the dialog while scrolling down?</p>