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

How to create a NumericTextbox in .axml in Xamarin.Android

Platform: Xamarin.Forms |
Control: SfNumericTextBox |
Published Date: April 5, 2017 |
Last Revised Date: April 5, 2017

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

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
ADD COMMENT
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.

Up arrow icon

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

Live Chat Icon For mobile
Live Chat Icon