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. Image for the cookie policy date

Keyboard Flags and Selected Item Issue

Hi All,

I have a couple of issues with SfAutoComplete using Xamarin forms MVVM both are with Android, they work fine in iOS.

I have set some keyboard flags when the SfAutoComplete gets focus to change from Capitalize Words to Capitalize Charactors depending a boolean that is user defined.
this work fine with iOS but on Android it does not take effect, it does work fine if used with an entry.

Also again on Android randomly when using SfAutoComplete if the dropdown is populated but the final word is not in the list or selected from the row of words above the keyboard the app crashes with an index error.

Any help please.

4 Replies

MK Muneesh Kumar G Syncfusion Team August 21, 2019 12:21 PM UTC

Hi Nic, 
 
Greetings from Syncfusion.  
 
Query 1: When the SfAutoComplete gets focus to change from Capitalize Words to Capitalize Characters. 
 
We have analyzed the requirement from our side. You can achieve this by using the custom renderer for the SfAutoComplete. We have prepared the simple sample for your reference. Please try the attached below sample and let us know if you have any concern on this. 
 
Code Snippet: 
public class CustomRendererAndroid : SfAutoCompleteRenderer 
    { 
        public CustomRendererAndroid() 
        { 
        } 
        protected override void OnElementChanged(ElementChangedEventArgs<Syncfusion.SfAutoComplete.XForms.SfAutoComplete> e) 
        { 
            base.OnElementChanged(e); 
            if (Control != null) 
            { 
                Control.FocusChanged += Control_FocusChanged; 
            } 
        } 
        private void Control_FocusChanged(object sender, Com.Syncfusion.Autocomplete.FocusChangedEventArgs e) 
        { 
            if (e.HasFocus) 
            { 
                if (Control != null) 
                { 
                    Control.InputType = Android.Text.InputTypes.TextFlagCapCharacters; 
                } 
            } 
        } 
    } 
 
Query 2:Selected from the row of words above the keyboard the app crashes with an index error. 
 
We have analyzed the reported issue from our side. We are unable to reproduce the reported issue in our end. Please check with the below sample and if the issue mentioned occurs in different scenario. Please modify the sample with the issue reproducing sample which will be helpful for us to analyze further and provide an appropriate solution. 
  
Sample Link: 
 
Regards,  
Muneesh Kumar G 
 



NI Nic August 22, 2019 08:54 AM UTC

Hi Muneesh,

Thank you very much for the Android renderer it works perfectly,
to keep thinks all nice and tidy i would like to use the renderer for iOS but i am stuck with the control type i looked at your sample but have not been able to work out what goes after the Control.

Control.<what goes here> = UITextAutocapitalizationType.AllCharacters;

After creating the Android renderer i have not had the app crash, so must have been something in my code.

Regards
Nic


NI Nic August 22, 2019 11:46 AM UTC

Hi Muneesh,

I've sorted the iOS renderer as below:

var editText = Control.TextField as UITextField;
 editText.AutocapitalizationType = UITextAutocapitalizationType.Words;

thanks for you help.

Regards
Nic
 


MK Muneesh Kumar G Syncfusion Team August 23, 2019 08:54 AM UTC

Hi Nic, 
 
Glad that the issue has been resolved and please get back to us if you need any other assistance.  
 
Regards, 
Muneesh Kumar G 


Loader.
Live Chat Icon For mobile
Up arrow icon