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

How to remove the underline in SfAutoComplete?

Thread ID:

Created:

Updated:

Platform:

Replies:

146813 Aug 21,2019 06:27 AM UTC Aug 22,2019 12:11 PM UTC Xamarin.Forms 5
loading
Tags: SfAutoComplete
Bharath
Asked On August 21, 2019 07:21 AM UTC

How to make SfAutocomplete as Rounded entry ?
https://ibb.co/Rpx3Gyg

Muneesh Kumar G [Syncfusion]
Replied On August 21, 2019 09:56 AM UTC

Hi Bharath, 
 
Greetings from Syncfusion.  
 
We have analyzed your requirement and we have achieved this by using custom renderer with Rounded Corner and without underline in SfAutoComplete. Please have the code snippet and sample from the below link, 
 
Code Snippet: 
Android: 
 
if (Control != null) 
       { 
                GradientDrawable gd = new GradientDrawable(); 
                gd.SetColor(Android.Graphics.Color.White); 
                gd.SetCornerRadius(12); 
                gd.SetStroke(2, Android.Graphics.Color.LightGray); 
                this.Control.SetBackgroundDrawable(gd);   
    } 
 
iOS: 
 
if (Control != null) 
            { 
                if (e.NewElement != null) 
                    e.NewElement.SizeChanged += (obj, args) => 
                    { 
                        var borderLayer = new CALayer(); 
                        borderLayer.Frame = new CoreGraphics.CGRect(0, 0, this.Control.Frame.Width, this.Control.Frame.Height); 
                        borderLayer.BackgroundColor = UIColor.Clear.CGColor; 
                        borderLayer.BorderColor = UIColor.Gray.CGColor; 
                        borderLayer.BorderWidth = 2; 
                        borderLayer.CornerRadius = 10; 
                        this.Control.TextField.BorderStyle = UITextBorderStyle.None; 
                        this.Control.Layer.AddSublayer(borderLayer); 
                    }; 
            } 
 
Screenshot: 


Please check with the sample and let us know if you have any concern.
 
 
Regards,  
Muneesh Kumar G 
 


Bharath
Replied On August 21, 2019 10:05 AM UTC

I have tried with your same example for sfautocomplete control. That underline is still showing. @Muneesh Kumar 
protected override void OnElementChanged(ElementChangedEventArgs<SfAutoComplete> e)
		{
			base.OnElementChanged(e);
			if (Control != null)
			{
                //Control.Background = Context.GetDrawable(Resource.Drawable.rounded_corners);
                GradientDrawable gd = new GradientDrawable();
                gd.SetShape(ShapeType.Rectangle);
                gd.SetColor(Android.Graphics.Color.Transparent);
                gd.SetCornerRadius(15);
                gd.SetStroke(4, Android.Graphics.Color.LightGray);
                //Control.AutoEditText.SetBackgroundColor(Android.Graphics.Color.Transparent);
                Control.SetBackgroundDrawable(gd);
            }
		}

Muneesh Kumar G [Syncfusion]
Replied On August 21, 2019 11:54 AM UTC

Hi Bharath, 
 
To remove the underline, you have to set the ShowBorder API as false in SfAutoComplete. Please have the code snippet and sample from the below link, 
 
Code Snippet: 
 
ShowBorder="False"   
 
 
 
 
Screenshot: 


Please check with the sample and let us know if you have any concern. 
 
Regards,  
Muneesh Kumar G 
 


Bharath
Replied On August 22, 2019 12:08 PM UTC

Thank you it worked for me..

Muneesh Kumar G [Syncfusion]
Replied On August 22, 2019 12:11 PM UTC

Hi Bharath, 
 
Thanks for the update. 
  
We are glad to know that the given solution works. Please let us know if you need any further 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