Xamarin.Forms.Stepper Class
A Xamarin.Forms.View control that inputs a discrete value, constrained to a range.

See Also: Stepper Members

Syntax

public class Stepper : View

Remarks

The following example shows a basic use.

C# Example

using System;
using Xamarin.Forms;

namespace FormsGallery
{
    class StepperDemoPage : ContentPage
    {
        Label label;

        public StepperDemoPage()
        {
            Label header = new Label
            {
                Text = "Stepper",
                Font = Font.BoldSystemFontOfSize(50),
                HorizontalOptions = LayoutOptions.Center
            };

            Stepper stepper = new Stepper
            {
                Minimum = 0,
                Maximum = 10,
                Increment = 0.1,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };
            stepper.ValueChanged += OnStepperValueChanged;

            label = new Label
            {
                Text = "Stepper value is 0",
                Font = Font.SystemFontOfSize(NamedSize.Large),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            // Accomodate iPhone status bar.
            this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);

            // Build the page.
            this.Content = new StackLayout
            {
                Children =
                {
                    header,
                    stepper,
                    label
                }
            };
        }

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

The Xamarin.Forms.Stepper class has the following XAML properties:

PropertyValue
Increment

An integer or decimal literal.

Maximum

An integer or decimal literal.

Minimum

An integer or decimal literal. If this value is nonnegative, it must appear lexically below Maximum, so that validation can succeed.

Value

An integer or decimal literal that represents a number that is in the range[Minimum,Maximum].

ValueChangedThe name of an event handler. Note that this tag must appear below Value.

Requirements

Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions: 1.0.0.0, 1.1.0.0, 1.2.0.0, 1.3.0.0