2X faster development
The ultimate Xamarin UI toolkit to boost your development speed.
This article explains how to create a Syncfusion SfNumericUpDown without having their border as shown in the following image.
It has been achieved by using the custom renderer of Xamarin.Forms SfNumericUpDown with platform specific as shown in the following code changes.
[XAML]
Control initialization with custom numericUpDown class.
<local:CustomNumericUpDown x:Name="sfNumericUpDown" HeightRequest="100" Value="100" AllowNull="false" FormatString="n"/>
Create a CustomNumericUpDown class, which is inherited from SfNumericUpDown.
public class CustomNumericUpDown : SfNumericUpDown { } AndroidIt has been achieved by setting the null to the EditText background, which is a child of native numeric control as shown in the following code sample.
protected override void OnElementChanged(ElementChangedEventArgs<Syncfusion.SfNumericUpDown.XForms.SfNumericUpDown> e) { base.OnElementChanged(e); if (Control != null) { for (int i = 0; i < Control.ChildCount; i++) { var child = Control.GetChildAt(i); if (child is EditText) { var control = child as EditText; control.Background = null; } } } } iOSTo achieve the same in iOS, set the 0 as border width of the native control.
protected override void OnElementChanged(ElementChangedEventArgs<Syncfusion.SfNumericUpDown.XForms.SfNumericUpDown> e) { base.OnElementChanged(e); if (this.Control != null) { /// For Achieving Borderwidth customization. this.Control.Layer.BorderWidth = 0f; } } UWPBy setting the 0 as border thickness as shown in the following code sample.
protected override void OnElementChanged(ElementChangedEventArgs<SfNumericUpDown> e) { base.OnElementChanged(e); if (Control != null) { Control.BorderThickness = new Windows.UI.Xaml.Thickness(0); } }
See also
|
2X faster development
The ultimate Xamarin UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.