Prashanth R
Prashanth R

Reputation: 41

Numeric UpDown Control for Xamarin Forms

Can any one Please provide Numeric UpDown Control demo with Xamarin Forms Does this control Available in Xamarin Forms? thanks Prashanth

Upvotes: 4

Views: 7747

Answers (3)

Nithin joy
Nithin joy

Reputation: 336

You can use Stepper for this:

XAML

<Stepper Value="5" 
         Minimum="0" 
         Maximum="10" 
         Increment="0.1" 
         HorizontalOptions="LayoutOptions.Center" 
         VerticalOptions="LayoutOptions.CenterAndExpand"
         ValueChanged="OnValueChanged" /> 

C#
void OnValueChanged(object sender, ValueChangedEventArgs e) {  
    lbldisp.Text = String.Format("Stepper value is {0:F1}", e.NewValue);  
}  

Upvotes: 4

Aditya Deshpande
Aditya Deshpande

Reputation: 131

https://learn.microsoft.com/en-us/dotnet/api/xamarin.forms.stepper?view=xamarin-forms maybe this could help. you might want to write a custom render for putting that textBox in between the -/+ buttons but sure if you can use as it is, it works fine.

Upvotes: 1

hvaughan3
hvaughan3

Reputation: 11105

See edit #2.

No there is not a spinner control out-of-the-box. If you do not want to get creative, you could use the Picker control and insert predefined values into it. Picker info here.

Otherwise it would be pretty trivial to create an up and down Button and an Entry or Label. Clicking the up Button increments a number in the Entry or Label. Clicking the down Button decrements a number in the Entry or Label.

*Edit: Just happened to land on Syncfusion's NumericUpDown control which does want you want. You can also get a free community license for the control if you are a lone developer or a group of 5 or fewer people. Community License info here

*Edit #2: Was looking through the Xamarin Views list page here and saw that actually do have a Stepper control now!

Upvotes: 8

Related Questions