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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to bind value in NumerictextBox?

Platform: Xamarin.Forms |
Control: SfNumericTextBox |
Published Date: August 26, 2016 |
Last Revised Date: July 4, 2019

To bind the value in NumericTextBox, follow the given steps:

Step 1:  Create the NumericTextBox sample and include the necessary source files.

Step 2: Create an instance for ViewModel and NumericTextBox.

Step 3: Set the BindingContext to ViewModel.

Step 4: The ViewModel class extends INotifyPropertyChanged and it gets and sets the value.

Step 5: Now SetBinding for the NumericTextBox instance created. The parameters in Binding will have the ValueProperty and where the value is binded and it specifies the binding mode.

Code Snippet

//NumericTextBox class


public class NumericTextBox : ContentPage


    public NumericTextBox ()


         Label label1 = new Label ();

         label1.Text = "Monetary";

         ViewModel viewModel = new ViewModel ();

          var textBox = new SfNumericTextBox()


  HorizontalOptions = LayoutOptions.FillAndExpand,

  FormatString = "c",

  MaximumNumberDecimalDigits = 2   


 textBox.BindingContext = viewModel;

 textBox.SetBinding(SfNumericTextBox.ValueProperty,"Value", BindingMode.TwoWay);


            StackLayout stack = new StackLayout ();

 stack.Orientation = StackOrientation.Vertical;

 stack.Children.Add (label1);

 stack.Children.Add (textBox);


            this.Content = stack;




//ViewModel class


public class ViewModel : INotifyPropertyChanged


 public event PropertyChangedEventHandler PropertyChanged;

 public ViewModel ()



 private float _value=5;


 public float Value


     get{ return _value;}

     set{_value = value;RaisePropertyChanged ();}



            protected void RaisePropertyChanged([CallerMemberName]string propertyName = "")


   if (this.PropertyChanged != null)


      this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));






2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

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