Forum Xamarin.Forms

Close keyboard when scrolling in ListView

CaritasracerCaritasracer DEMember ✭✭
edited February 2018 in Xamarin.Forms


i have a setup as following: An entry at the top of the page and beyond a ListView. If i focus the entry, the keyboard gets visible and overlays the ListView. So far so good.

In the next step i scroll in the ListView and the Keyboard stays open. I want the Keyboard to get closed when im scrolling in the ListView.

For some reason the entry stays in focus when i'm scrolling the ListView. Unfortunately there is no Event "IsScrolling" or something on the ListView, which i could use to fix that manually.

Any ideas how to fix that?

Thx, Robert



  • juanzeta33juanzeta33 USMember ✭✭
    edited March 2018

    I flag the question cuz i want to know the answer, but thinking, what about if you use the TapGesture event of the listview and use the entryName.unfocus method.

    Look this code, they use a interface to control it

  • AlexStrongAlexStrong GBMember ✭✭

    In case it helps anyone I was faffing about trying to come up with something for this too. First idea was to unfocus the keyboard using the ItemAppearing event of the listview but as results were coming back from our server the keyboard would dismiss as you typed.

    We were going to use an IsSearching flag but came up with an easier way of doing it by just sending a message using the messagecenter once all results had come back to unfocus the entry e.g. in viewmodel

    MessagingCenter.Send<MainViewModel, bool>(this, Messages.SearchComplete, true);

    And then in the code behind

    MessagingCenter.Subscribe<ViewModels.MainViewModel, bool>(this, App.Messages.SearchComplete, async (sender, e) =>

Sign In or Register to comment.