Xamarin forms: Keyboard is not hiding when click background in xamarin forms IOS












0















In the normal case of xamarin forms ios app, the keyboard is hiding when taps on the background. Also, scrolling works perfectly when the keyboard is on.



But when the page contains listview, the keyboard is not closing when background tap and scrolling is not working in the same case.



How can I fix this issue? I need to close the keyboard when clicking the background and need scrolling feature. Error screenshot in android:



enter image description here










share|improve this question





























    0















    In the normal case of xamarin forms ios app, the keyboard is hiding when taps on the background. Also, scrolling works perfectly when the keyboard is on.



    But when the page contains listview, the keyboard is not closing when background tap and scrolling is not working in the same case.



    How can I fix this issue? I need to close the keyboard when clicking the background and need scrolling feature. Error screenshot in android:



    enter image description here










    share|improve this question



























      0












      0








      0








      In the normal case of xamarin forms ios app, the keyboard is hiding when taps on the background. Also, scrolling works perfectly when the keyboard is on.



      But when the page contains listview, the keyboard is not closing when background tap and scrolling is not working in the same case.



      How can I fix this issue? I need to close the keyboard when clicking the background and need scrolling feature. Error screenshot in android:



      enter image description here










      share|improve this question
















      In the normal case of xamarin forms ios app, the keyboard is hiding when taps on the background. Also, scrolling works perfectly when the keyboard is on.



      But when the page contains listview, the keyboard is not closing when background tap and scrolling is not working in the same case.



      How can I fix this issue? I need to close the keyboard when clicking the background and need scrolling feature. Error screenshot in android:



      enter image description here







      ios scroll xamarin.forms keyboard






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 8:20







      Sreejith Sree

















      asked Nov 22 '18 at 9:07









      Sreejith SreeSreejith Sree

      396212




      396212
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Cause:



          When the listview is scrolling.The touch event will be blocked.



          Solution:



          You can set the keyboard dismiss when you start scroll the listView.You should implement it in CustomRenderer.Refer the following code.




          in Forms




          namespace xxx
          {
          public class MyListView:ListView
          {
          public MyListView()
          {

          }
          }
          }



          in xxx.iOS




          [assembly:ExportRenderer(typeof(MyListView),typeof(MyiOSListView))] 
          namespace xxx.iOS
          {
          public class MyiOSListView:ListViewRenderer
          {
          public MyiOSListView()
          {

          }

          protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
          {
          base.OnElementChanged(e);

          if(Control!=null)
          {
          Control.KeyboardDismissMode = UIScrollViewKeyboardDismissMode.OnDrag;
          }

          }
          }
          }



          in xaml




           <local:MyListView>
          <local:MyListView.ItemsSource>
          ...
          </local:MyListView.ItemsSource>>
          </local:MyListView>





          share|improve this answer


























          • What change will come on the xaml part?

            – Sreejith Sree
            Nov 23 '18 at 8:02











          • Check my update answer.

            – Lucas Zhang - MSFT
            Nov 23 '18 at 8:08











          • I have android and UWP projects, getting error on android project

            – Sreejith Sree
            Nov 23 '18 at 8:20











          • I am testing the ios app in simulator, keyboard is not showing on simulator, is there any way to check this feature with keyboard?

            – Sreejith Sree
            Nov 23 '18 at 8:21











          • Hardware->keyboard->connect hardware keyboard

            – Lucas Zhang - MSFT
            Nov 23 '18 at 8:23











          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%2f53427274%2fxamarin-forms-keyboard-is-not-hiding-when-click-background-in-xamarin-forms-ios%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









          0














          Cause:



          When the listview is scrolling.The touch event will be blocked.



          Solution:



          You can set the keyboard dismiss when you start scroll the listView.You should implement it in CustomRenderer.Refer the following code.




          in Forms




          namespace xxx
          {
          public class MyListView:ListView
          {
          public MyListView()
          {

          }
          }
          }



          in xxx.iOS




          [assembly:ExportRenderer(typeof(MyListView),typeof(MyiOSListView))] 
          namespace xxx.iOS
          {
          public class MyiOSListView:ListViewRenderer
          {
          public MyiOSListView()
          {

          }

          protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
          {
          base.OnElementChanged(e);

          if(Control!=null)
          {
          Control.KeyboardDismissMode = UIScrollViewKeyboardDismissMode.OnDrag;
          }

          }
          }
          }



          in xaml




           <local:MyListView>
          <local:MyListView.ItemsSource>
          ...
          </local:MyListView.ItemsSource>>
          </local:MyListView>





          share|improve this answer


























          • What change will come on the xaml part?

            – Sreejith Sree
            Nov 23 '18 at 8:02











          • Check my update answer.

            – Lucas Zhang - MSFT
            Nov 23 '18 at 8:08











          • I have android and UWP projects, getting error on android project

            – Sreejith Sree
            Nov 23 '18 at 8:20











          • I am testing the ios app in simulator, keyboard is not showing on simulator, is there any way to check this feature with keyboard?

            – Sreejith Sree
            Nov 23 '18 at 8:21











          • Hardware->keyboard->connect hardware keyboard

            – Lucas Zhang - MSFT
            Nov 23 '18 at 8:23
















          0














          Cause:



          When the listview is scrolling.The touch event will be blocked.



          Solution:



          You can set the keyboard dismiss when you start scroll the listView.You should implement it in CustomRenderer.Refer the following code.




          in Forms




          namespace xxx
          {
          public class MyListView:ListView
          {
          public MyListView()
          {

          }
          }
          }



          in xxx.iOS




          [assembly:ExportRenderer(typeof(MyListView),typeof(MyiOSListView))] 
          namespace xxx.iOS
          {
          public class MyiOSListView:ListViewRenderer
          {
          public MyiOSListView()
          {

          }

          protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
          {
          base.OnElementChanged(e);

          if(Control!=null)
          {
          Control.KeyboardDismissMode = UIScrollViewKeyboardDismissMode.OnDrag;
          }

          }
          }
          }



          in xaml




           <local:MyListView>
          <local:MyListView.ItemsSource>
          ...
          </local:MyListView.ItemsSource>>
          </local:MyListView>





          share|improve this answer


























          • What change will come on the xaml part?

            – Sreejith Sree
            Nov 23 '18 at 8:02











          • Check my update answer.

            – Lucas Zhang - MSFT
            Nov 23 '18 at 8:08











          • I have android and UWP projects, getting error on android project

            – Sreejith Sree
            Nov 23 '18 at 8:20











          • I am testing the ios app in simulator, keyboard is not showing on simulator, is there any way to check this feature with keyboard?

            – Sreejith Sree
            Nov 23 '18 at 8:21











          • Hardware->keyboard->connect hardware keyboard

            – Lucas Zhang - MSFT
            Nov 23 '18 at 8:23














          0












          0








          0







          Cause:



          When the listview is scrolling.The touch event will be blocked.



          Solution:



          You can set the keyboard dismiss when you start scroll the listView.You should implement it in CustomRenderer.Refer the following code.




          in Forms




          namespace xxx
          {
          public class MyListView:ListView
          {
          public MyListView()
          {

          }
          }
          }



          in xxx.iOS




          [assembly:ExportRenderer(typeof(MyListView),typeof(MyiOSListView))] 
          namespace xxx.iOS
          {
          public class MyiOSListView:ListViewRenderer
          {
          public MyiOSListView()
          {

          }

          protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
          {
          base.OnElementChanged(e);

          if(Control!=null)
          {
          Control.KeyboardDismissMode = UIScrollViewKeyboardDismissMode.OnDrag;
          }

          }
          }
          }



          in xaml




           <local:MyListView>
          <local:MyListView.ItemsSource>
          ...
          </local:MyListView.ItemsSource>>
          </local:MyListView>





          share|improve this answer















          Cause:



          When the listview is scrolling.The touch event will be blocked.



          Solution:



          You can set the keyboard dismiss when you start scroll the listView.You should implement it in CustomRenderer.Refer the following code.




          in Forms




          namespace xxx
          {
          public class MyListView:ListView
          {
          public MyListView()
          {

          }
          }
          }



          in xxx.iOS




          [assembly:ExportRenderer(typeof(MyListView),typeof(MyiOSListView))] 
          namespace xxx.iOS
          {
          public class MyiOSListView:ListViewRenderer
          {
          public MyiOSListView()
          {

          }

          protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
          {
          base.OnElementChanged(e);

          if(Control!=null)
          {
          Control.KeyboardDismissMode = UIScrollViewKeyboardDismissMode.OnDrag;
          }

          }
          }
          }



          in xaml




           <local:MyListView>
          <local:MyListView.ItemsSource>
          ...
          </local:MyListView.ItemsSource>>
          </local:MyListView>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 23 '18 at 8:08

























          answered Nov 23 '18 at 6:28









          Lucas Zhang - MSFTLucas Zhang - MSFT

          1,975228




          1,975228













          • What change will come on the xaml part?

            – Sreejith Sree
            Nov 23 '18 at 8:02











          • Check my update answer.

            – Lucas Zhang - MSFT
            Nov 23 '18 at 8:08











          • I have android and UWP projects, getting error on android project

            – Sreejith Sree
            Nov 23 '18 at 8:20











          • I am testing the ios app in simulator, keyboard is not showing on simulator, is there any way to check this feature with keyboard?

            – Sreejith Sree
            Nov 23 '18 at 8:21











          • Hardware->keyboard->connect hardware keyboard

            – Lucas Zhang - MSFT
            Nov 23 '18 at 8:23



















          • What change will come on the xaml part?

            – Sreejith Sree
            Nov 23 '18 at 8:02











          • Check my update answer.

            – Lucas Zhang - MSFT
            Nov 23 '18 at 8:08











          • I have android and UWP projects, getting error on android project

            – Sreejith Sree
            Nov 23 '18 at 8:20











          • I am testing the ios app in simulator, keyboard is not showing on simulator, is there any way to check this feature with keyboard?

            – Sreejith Sree
            Nov 23 '18 at 8:21











          • Hardware->keyboard->connect hardware keyboard

            – Lucas Zhang - MSFT
            Nov 23 '18 at 8:23

















          What change will come on the xaml part?

          – Sreejith Sree
          Nov 23 '18 at 8:02





          What change will come on the xaml part?

          – Sreejith Sree
          Nov 23 '18 at 8:02













          Check my update answer.

          – Lucas Zhang - MSFT
          Nov 23 '18 at 8:08





          Check my update answer.

          – Lucas Zhang - MSFT
          Nov 23 '18 at 8:08













          I have android and UWP projects, getting error on android project

          – Sreejith Sree
          Nov 23 '18 at 8:20





          I have android and UWP projects, getting error on android project

          – Sreejith Sree
          Nov 23 '18 at 8:20













          I am testing the ios app in simulator, keyboard is not showing on simulator, is there any way to check this feature with keyboard?

          – Sreejith Sree
          Nov 23 '18 at 8:21





          I am testing the ios app in simulator, keyboard is not showing on simulator, is there any way to check this feature with keyboard?

          – Sreejith Sree
          Nov 23 '18 at 8:21













          Hardware->keyboard->connect hardware keyboard

          – Lucas Zhang - MSFT
          Nov 23 '18 at 8:23





          Hardware->keyboard->connect hardware keyboard

          – Lucas Zhang - MSFT
          Nov 23 '18 at 8:23


















          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427274%2fxamarin-forms-keyboard-is-not-hiding-when-click-background-in-xamarin-forms-ios%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







          Popular posts from this blog

          Costa Masnaga

          Fotorealismo

          Sidney Franklin