We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

autoComplete.IsFocused = false doesn't hide keyboard on Android

Thread ID:

Created:

Updated:

Platform:

Replies:

146392 Aug 2,2019 08:56 AM UTC Aug 7,2019 07:33 AM UTC Xamarin.Forms 3
loading
Tags: SfAutoComplete
Radoslaw Kubas
Asked On August 2, 2019 08:56 AM UTC

Hello,

I need to unfocuse SfAutoComplete when Pan gesture started on other control. I used simple code like "autoComplete.IsFocused = false ". On iOS it seems to works fine, but on Android, behaviour is strange. Control looks unfocused, but soft keyboard stays open (but change its looks).

To reproduce just:

xml:
<StackLayout>
     <SfAutoComplete x:Name="autoComplete"/>
</StackLayout>

<Label Text="Pan to Unfocus">
     <Label.GestureRecognizers>
          <PanGestureRecognizer PanUpdated="PanGestureRecognizer_OnPanUpdated"/>
     </Label.GestureRecognizers>
</Label>

code:
private void PanGestureRecognizer_OnPanUpdated(object sender, PanUpdatedEventArgs e)
{
     autoComplete.IsFocused = false;
}

Regards,
Radek

Muneesh Kumar G [Syncfusion]
Replied On August 5, 2019 09:39 AM UTC

Hi Radoslaw, 
 
Greetings from Syncfusion. 
 
We have achieved your requirement by using custom renderer to dismiss the keyboard when focus got changed in SfAutoComplete Control. Please have the sample from the below link. 
 
 
Code Snippet: 
 private void Control_FocusChanged(object sender, Com.Syncfusion.Autocomplete.FocusChangedEventArgs e) 
        { 
            if (!e.HasFocus) 
            { 
                this.inputManager = (InputMethodManager)this.Context.GetSystemService(Android.Content.Context.InputMethodService); 
                this.inputManager.HideSoftInputFromWindow(Control.GetAutoEditText().WindowToken, 0); 
            } 
        } 
 
Please check with the sample and let us know if you have any concern. 
 
Thanks,    
Muneesh Kumar G.    
 


Radoslaw Kubas
Replied On August 7, 2019 05:40 AM UTC

Hello,

Thank you very much for help, it works like a charm. I also noticed that this issue was fixed in the latest SfAutoComplete version. Am I right?

Anyway, once again thank you for amazing support.

Best regards,
Radek

Muneesh Kumar G [Syncfusion]
Replied On August 7, 2019 07:33 AM UTC

Hi Radoslaw,  
 
Thanks for your update.  
 
We didn’t include any fix in our latest version. However, we glad that the issue has been resolved and please get back to us if you need any other assistance.  
 
Thanks, 
Muneesh Kumar G. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon