How to control the keyboard download event in iOS

fytosk8fytosk8 Member ✭✭
edited December 2018 in Xamarin.Forms

I have a form in Xamarin with two (entry controls) one of them, when doing Tap it opens a modal window that contains a list and the other has a normal operation, everything works well until the user opens the normal Entry keyboard first and then call the modal, when this happens the keyboard is up and the list is shown blocking the view of the user as follows...

I would like to change this behavior, so I attach the XAML code of the view

MyView.XAML:

<Entry             
            Placeholder="Nombre Sustancia Química"
            Margin="15,5,15,5"
            HorizontalOptions="FillAndExpand"
            Text="{Binding NombreSustancia, Mode=TwoWay}"
            IsEnabled="{Binding EntryEnabled}">
        </Entry>


       <Entry    
            x:Name="Make"
            Placeholder="Seleccione Fabricante"
            Margin="15,5,15,5"
            Focused="Entry_Focused"
            HorizontalOptions="FillAndExpand"
            Text="{Binding NombreFabricante, Mode=TwoWay}"
            IsEnabled="{Binding EntryEnabled}">
       </Entry>

MyView.XAML.CS:

public partial class FiltrosSisquimView : ContentPage
    {
        public ObservableCollection<Fabricante> Fabricantes { get; set; }


        public FiltrosSisquimView ()
        {              
            InitializeComponent();            
        }

        private async void Entry_Focused(object sender, FocusEventArgs e)
        {
            //prevents the keyboard from opening when calling the modal
            Make.Unfocus();          
            var mainViewModel = MainViewModel.GetInstance();
            Fabricantes = mainViewModel.Filtros.Fabricantes;
            mainViewModel.FabricantesModal = new FabricantesModalViewModel(Fabricantes);
            await Application.Current.MainPage.Navigation.PushModalAsync(new FabricantesModalView());
        }      

    }

I must say, that this problem only happens in iOS, and that Android has the expected behavior (when opening the modal the keyboard is automatically lowered), how could the keyboard go down when the user has already opened the list? Where should I control this event? on the modal page? in the codebehind? I am occupying MVVM as architectural pattern

any help for me?

Best Answer

Answers

Sign In or Register to comment.