Articles in this section
Category / Section

How to create NumericTextBox sample in Xamarin.Forms.iOS platform

1 min read

NumericTextBox is an advanced version of the Entry control that restricts input to numeric values.The below illustrates how to create the carousel control in Xamarin.Forms iOS platforms.

Needed assemblies: 

For getting the view of NumericTextBox control, need to add the following assemblies in both PCL and iOS (unified) in Xamarin.



Assemblies Required




iOS (unified)




Create a NumericTextBox in C# level:


namespace KBSolution
public partial class KBSolutionPage : ContentPage
    public KBSolutionPage()
        Grid grid = new Grid() { BackgroundColor = Color.FromHex("E4EAF0") };
        grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(30) });
        grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(50) });
        Label firstNumeric = new Label()
            Text = "NumericTextBox",
            FontSize = 20,
            HorizontalOptions = LayoutOptions.Center,
            FontAttributes = FontAttributes.Bold,
            HorizontalTextAlignment = TextAlignment.Start,
            VerticalTextAlignment = TextAlignment.Start
        SfNumericTextBox sfNumericTextBox = new SfNumericTextBox()
            WidthRequest = 180,
            ParserMode = Parsers.Decimal,
            HorizontalOptions = LayoutOptions.Center,
            MaximumNumberDecimalDigits = 2,
            AllowNull = true,
            BorderColor = Color.Blue,
            TextColor = Color.Maroon,
            Value = 1000,
            FormatString = "c",
            ValueChangeMode = ValueChangeMode.OnKeyFocus,
            PercentDisplayMode = PercentDisplayMode.Value,
            FontSize = 20
        grid.Children.Add(firstNumeric, 0, 0);
        grid.Children.Add(sfNumericTextBox, 0, 1);
        this.Content = grid;


Create a NumericTextBox in Xaml level:


<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="" 
    <Grid  BackgroundColor="#E4EAF0">
            <RowDefinition Height="30"/>
            <RowDefinition Height="50"/>
          <Label x:Name="firstNumeric" Text="NumericTextBox" FontSize="20" HorizontalOptions="Center"  FontAttributes="Bold" HorizontalTextAlignment="Start" VerticalTextAlignment="Start"/>
            FontSize="20" />
        </Grid >



Note: Need to add the Renderer of NumericTextBox in AppDelegate class to get the view of NumericTextBox in iOS platforms.


namespace KBSolution.iOS
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        new SfNumericTextBoxRenderer();
        LoadApplication(new App());

        return base.FinishedLaunching(app, options);





Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment