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
close icon

Custom Renderer not fireing in Xamarin Forms (Android)

I am trying to remove the underline in the Syncfusion Autocomplete plugin ( or atleast make it transparent), this is my code:

    [assembly: ExportRenderer(typeof(SfAutoComplete), typeof(AutoCompleteRenderer))]
   namespace Pets.Droid
{
    public class AutoCompleteRenderer : SfAutoCompleteRenderer
    {

        protected override void OnElementChanged(ElementChangedEventArgs<SfAutoComplete> e)
        {
            base.OnElementChanged(e);
            if (Control != null)
            {
                GradientDrawable gd = new GradientDrawable();
                gd.SetStroke(0, Android.Graphics.Color.Transparent);
                Control.SetBackground(gd);
            }
        }
    }
}

but for some reason it wont fire, I also tried to create a custom MyAutoComplete class that inherits from SfAutoComplete and change the input in my XAML to local:MyAutoComplete but same results.

Anyone see what could be the issue?


3 Replies

VA Vanaja  Annasamy Syncfusion Team March 13, 2019 12:16 PM UTC

Hi Chris,

Greetings from Syncfusion support.

We suggest you to use ShowBorder property to enable/disable the border in SfAutoComplete. We have created the sample for your reference. Please download it from the below link.

Sample link:  http://www.syncfusion.com/downloads/support/forum/143274/ze/AutoComplete_1146430840 

Please try our sample and let us know if you have any concern on this.

Regards,
Vanaja R.A. 



CH Chris March 13, 2019 01:19 PM UTC

Thank you, I had no idea that line had to do anything with border, I would have called it an underline or similar. But, thank you, it works as intended now


DR Dhanasekar R Syncfusion Team March 14, 2019 12:36 PM UTC

 Hi Chris, 
 
Glad that the solution works. Please get back to us if any further assistance on this. 
 
Regards, 
Dhanasekar 


Loader.
Live Chat Icon For mobile
Up arrow icon