How to remove CornerRadius of the SfCombobox?

Hello Synfusion Support, 
I have a control SfCombobox with BackgroundColor is Red, I easy using CustomView for display Control which I want, but my form has very much controls, I don't want use CustomView because it maybe causes my application to be slowed. 

I received here:


I want here:


Or here:


Any solution for this?
Thanks..

5 Replies 1 reply marked as answer

SS Suganya Sethuraman Syncfusion Team September 24, 2020 12:16 PM UTC

Hi Nguyen,

Greetings from Syncfusion.

We have analyzed your requirement. We have achieved your requirement using CustomRenderer. Please add a custom renderer as shown below

Code snippet:
 
public class CustomRendereriOS : SfComboBoxRenderer 
    { 
        public CustomRendereriOS() 
        { 
        } 
        protected override void OnElementChanged(ElementChangedEventArgs<Syncfusion.XForms.ComboBox.SfComboBox> e) 
        { 
            base.OnElementChanged(e); 
            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 = 0; 
                        this.Control.TextField.BorderStyle = UITextBorderStyle.None; 
                        this.Control.Layer.AddSublayer(borderLayer); 
                    }; 
            } 
        } 
    } 

Please have the modified sample,

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ComboBoxNoBorder-1567481916
Please let us know if you have any concerns.

Regards,
Suganya Sethuraman.
 
 


Marked as answer

NK Nguyen Khoa Lu September 24, 2020 12:47 PM UTC

Thanks for your answer, 
I want to remove padding left of text too. 
Do you have solution?

Current: 



I want:



RS Ruba Shanmugam Syncfusion Team September 25, 2020 08:50 AM UTC

Hi Nguyen, 
We have validated your and set the left padding for the ComboBox by using SfComboBoxRenderer.  
Code Snippet: 
Android: 
if (Control != null) 
            { 
                if (!string.IsNullOrEmpty(Control.Watermark)) 
                { 
                    var editText = Control.GetAutoEditText(); 
                    editText.SetPadding(0, 0, 0, 0); 
                } 
            } 
iOS: 
  if (Control != null) 
            { 
                Control.TextField.LeftView = new UIView(new CGRect(0, 0, 0, 0)); 
                Control.TextField.LeftViewMode = UITextFieldViewMode.Always; 
            } 
 
 
Screenshot: 
 
Please let us know, if you have any other concerns. 
Regards, 
Ruba Shanmugam 
 



NK Nguyen Khoa Lu September 25, 2020 09:42 AM UTC

Problem had been fixed.
Thanks you very much.


SP Sakthivel Palaniyappan Syncfusion Team September 27, 2020 01:37 PM UTC

Hi Nguyen,

Thanks for the update.

We are glad to know that reported problem has been resolved at your end. Please let us know if you need further assistance on this.

Regards,
Sakthivel P.


Loader.
Up arrow icon