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 create a NumericTextbox in .axml in Xamarin.Android

In General, we have get the view of NumericTextBox is only from Activity class file. Here SfNumericTextBox provides a support to get the view of same from layout file. The following steps are required to get the view of NumericTextBox from layout file.

 

Step 1: Create a Xamarin.android solution with needed assembly

 

Step 2: Create a new layout file to add our Syncfusion ‘s NumericTextBox control

 

 

 

 

 

Step 3: Create an instance of NumericTextBox in layout file as well as add this layout as currently viewing activity by setting this layout as “SetContentView” as follows

 

Layout File:

 

 

MainActivity.cs File:

 

 

 

Step 4: Only the declaration of control is allowed in layout file. Properties have been set by created an instance of NumericTextBox with layout control id.

 

using Android.App;
using Android.Widget;
using Android.OS;
using Com.Syncfusion.Numerictextbox;

namespace NumericTextBoxLayout
{
[Activity(Label = "NumericTextBoxLayout", MainLauncher = true, Icon = "@mipmap/icon")]
public class MainActivity : Activity
{
    
    protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);

        SetContentView(Resource.Layout.NumericLayout);

        //Create an instance with layout's NumericTextBox id

         SfNumericTextBox sfNuemricTextBox = (SfNumericTextBox)FindViewById(Resource.Id.layoutNumeric);

        //setting the properties of NumericTextBox

        sfNuemricTextBox.Value = 3000;
    }

}
}

 

 

 

 

 

 

Sampe for download

Article ID: Published Date: Last Revised Date: Platform: Control:
7634 04/05/2017 04/05/2017 Xamarin.Forms SfNumericTextBox
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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