Class SfNumericUpDown
The SfNumericUpDown class allows users to adjust numeric values using increment and decrement buttons or by direct input. It supports value range constraints, step size, and culture-specific formatting.
Implements
Inherited Members
Namespace: Syncfusion.Maui.Toolkit.NumericUpDown
Assembly: Syncfusion.Maui.Toolkit.dll
Syntax
public class SfNumericUpDown : SfNumericEntry, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, ITextElement, ITouchListener, IKeyboardListener, ITextInputLayout, IParentThemeElement, IThemeElement
  Examples
The below example demonstrates how to initialize the SfNumericUpDown.
<numeric:SfNumericUpDown
      x:Name="numericUpDown"
      Value="10"
      Minimum="0"
      Maximum="100"
      WidthRequest="200"/>
Constructors
SfNumericUpDown()
Initializes a new instance of the SfNumericUpDown class. This control allows users to select a numeric value using up and down buttons.
Declaration
public SfNumericUpDown()
  Fields
AutoReverseProperty
Identifies AutoReverse dependency property.
Declaration
public static readonly BindableProperty AutoReverseProperty
  Field Value
| Type | Description | 
|---|---|
| Microsoft.Maui.Controls.BindableProperty | The identifier for the AutoReverse bindable property.  | 
      
DownButtonTemplateProperty
Identifies DownButtonTemplate bindable property.
Declaration
public static readonly BindableProperty DownButtonTemplateProperty
  Field Value
| Type | Description | 
|---|---|
| Microsoft.Maui.Controls.BindableProperty | The identifier for the DownButtonTemplate bindable property.  | 
      
LargeChangeProperty
Identifies LargeChange dependency property.
Declaration
public static readonly BindableProperty LargeChangeProperty
  Field Value
| Type | Description | 
|---|---|
| Microsoft.Maui.Controls.BindableProperty | The identifier for the LargeChange bindable property.  | 
      
SmallChangeProperty
Identifies SmallChange dependency property.
Declaration
public static readonly BindableProperty SmallChangeProperty
  Field Value
| Type | Description | 
|---|---|
| Microsoft.Maui.Controls.BindableProperty | The identifier for the SmallChange bindable property.  | 
      
UpButtonTemplateProperty
Identifies UpButtonTemplateProperty bindable property.
Declaration
public static readonly BindableProperty UpButtonTemplateProperty
  Field Value
| Type | Description | 
|---|---|
| Microsoft.Maui.Controls.BindableProperty | The identifier for the UpButtonTemplate bindable property.  | 
      
UpDownButtonAlignmentProperty
Identifies the UpDownButtonAlignment bindable property.
Declaration
public static readonly BindableProperty UpDownButtonAlignmentProperty
  Field Value
| Type | 
|---|
| Microsoft.Maui.Controls.BindableProperty | 
UpDownButtonColorProperty
Identifies UpDownButtonColor bindable property.
Declaration
public static readonly BindableProperty UpDownButtonColorProperty
  Field Value
| Type | Description | 
|---|---|
| Microsoft.Maui.Controls.BindableProperty | The identifier for the UpDownButtonColor bindable property.  | 
      
UpDownPlacementModeProperty
Identifies UpDownPlacementMode dependency property.
Declaration
public static readonly BindableProperty UpDownPlacementModeProperty
  Field Value
| Type | Description | 
|---|---|
| Microsoft.Maui.Controls.BindableProperty | The identifier for the UpDownPlacementMode bindable property.  | 
      
Properties
AutoReverse
Gets or sets a value indicating whether to enable or disable the cyclic behavior when the value reaches the minimum or maximum value.
Declaration
public bool AutoReverse { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | The default value is   | 
      
Examples
Below is an example of how to configure the AutoReverse property using XAML and C#:
DownButtonTemplate
Gets or sets a Data template for down button.
Declaration
public DataTemplate DownButtonTemplate { get; set; }
  Property Value
| Type | Description | 
|---|---|
| Microsoft.Maui.Controls.DataTemplate | The default value is null.  | 
      
Examples
Below is an example of how to define a custom template for the down button:
<numericUpDown:SfNumericUpDown x:Name="numericUpDown">
    <numericUpDown:SfNumericUpDown.DownButtonTemplate>
        <DataTemplate>
            <Grid>
                <Label 
                    Text="-" 
                    HorizontalOptions="Center" 
                    VerticalOptions="Center"
                    FontSize="16" 
                    FontAttributes="Bold" />
            </Grid>
        </DataTemplate>
    </numericUpDown:SfNumericUpDown.DownButtonTemplate>
</numericUpDown:NumericUpDown>
LargeChange
Gets or sets the value that is added to or subtracted from Value when a large change is made, such as with the PageUP and PageDown keys.
Declaration
public double LargeChange { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.Double | The default value is   | 
      
Examples
To set a large change value of 5 in XAML:
<numericUpDown:SfNumericUpDown
    x:Name="numericUpDown"
    LargeChange="5" />
To set a large change value of 5 in C#:
SfNumericUpDown numericUpDown = new SfNumericUpDown();
numericUpDown.LargeChange = 5;
this.Content = numericUpDown;
  
  
  
  SmallChange
Gets or sets the value that is added to or subtracted from Value when a small change is made, such as with an arrow key or scrolling.
Declaration
public double SmallChange { get; set; }
  Property Value
| Type | Description | 
|---|---|
| System.Double | The default value is   | 
      
Examples
To set a small change value of 0.1 in XAML:
<numericUpDown:SfNumericUpDown
    x:Name="numericUpDown"
    SmallChange="0.1" />
To set a small change value of 0.1 in C#:
SfNumericUpDown numericUpDown = new SfNumericUpDown();
numericUpDown.SmallChange = 0.1;
this.Content = numericUpDown;
  
  
  
  UpButtonTemplate
Gets or sets a Data template for up button.
Declaration
public DataTemplate UpButtonTemplate { get; set; }
  Property Value
| Type | Description | 
|---|---|
| Microsoft.Maui.Controls.DataTemplate | The default value is null.  | 
      
Examples
Below is an example of how to define a custom template for the up button:
<numericUpDown:SfNumericUpDown x:Name="numericUpDown">
    <numericUpDown:SfNumericUpDown.UpButtonTemplate>
        <DataTemplate>
            <Grid>
                <Label 
                    Text="+" 
                    HorizontalOptions="Center" 
                    VerticalOptions="Center"
                    FontSize="16" 
                    FontAttributes="Bold" />
            </Grid>
        </DataTemplate>
    </numericUpDown:SfNumericUpDown.UpButtonTemplate>
</numericUpDown:SfNumericUpDown>
UpDownButtonAlignment
Gets or sets the alignment of the buttons used to align increment or decrement the Value property.
Declaration
public UpDownButtonAlignment UpDownButtonAlignment { get; set; }
  Property Value
| Type | Description | 
|---|---|
| UpDownButtonAlignment | The default value is   | 
      
Remarks
In InlineVertical mode, if UpDownButtonAlignment is set to Both.
The "UpDown" buttons is aligned to the right side.
Examples
To set a large change value of 5 in XAML:
<numericUpDown:SfNumericUpDown
    x:Name="numericUpDown"
    UpDownButtonAlignment="Both" />
To set a large change value of 5 in C#:
SfNumericUpDown numericUpDown = new SfNumericUpDown();
numericUpDown.UpDownButtonAlignment = UpDownButtonAlignment.Both;
this.Content = numericUpDown;
  
  
  
  UpDownButtonColor
Gets or sets the color of the up and down buttons in the Syncfusion.Maui.Toolkit.NumericUpDown control.
Declaration
public Color UpDownButtonColor { get; set; }
  Property Value
| Type | Description | 
|---|---|
| Microsoft.Maui.Graphics.Color | The default value is Microsoft.Maui.Graphics.Colors.Black.  | 
      
Examples
To set the up and down button color to blue in XAML:
<numericUpDown:SfNumericUpDown
    x:Name="numericUpDown"
    UpDownButtonColor="Blue" />
To set the up and down button color to blue in C#:
SfNumericUpDown numericUpDown = new SfNumericUpDown();
numericUpDown.UpDownButtonColor = Colors.Blue;
this.Content = numericUpDown;
  
  
  
  UpDownPlacementMode
Gets or sets a value that indicates the placement of buttons used to increment or decrement the Value property.
Declaration
public NumericUpDownPlacementMode UpDownPlacementMode { get; set; }
  Property Value
| Type | Description | 
|---|---|
| NumericUpDownPlacementMode | The default value is Inline.  | 
      
Examples
To set the spin buttons to vertical in XAML:
<numericUpDown:SfNumericUpDown
    x:Name="numericUpDown"
    UpDownPlacementMode="InlineVertical" />
To set the spin buttons to vertical in C#:
SfNumericUpDown numericUpDown = new SfNumericUpDown();
numericUpDown.UpDownPlacementMode = NumericUpDownPlacementMode.InlineVertical;
this.Content = numericUpDown;
  Methods
GetSemanticsNodesCore(Double, Double)
Retrieves the list of semantics nodes for accessibility support, which represent how the control is perceived by assistive technologies.
Declaration
protected override List<SemanticsNode> GetSemanticsNodesCore(double width, double height)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Double | width | The width constraint for the semantics nodes.  | 
      
| System.Double | height | The height constraint for the semantics nodes.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.List<Syncfusion.Maui.Toolkit.Graphics.Internals.SemanticsNode> | A list of semantics nodes that describe the accessible elements within this control.  | 
      
Overrides
MeasureContent(Double, Double)
Measures the content of the control to determine the desired size based on the given constraints.
Declaration
protected override Size MeasureContent(double widthConstraint, double heightConstraint)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Double | widthConstraint | The maximum width available for the content.  | 
      
| System.Double | heightConstraint | The maximum height available for the content.  | 
      
Returns
| Type | Description | 
|---|---|
| Microsoft.Maui.Graphics.Size | The desired size for the content, which should be within the given constraints.  | 
      
Overrides
OnParentChanged()
Method called when the control's parent changes, allowing for adjustments related to the change in hierarchy or parent container.
Declaration
protected override void OnParentChanged()
  Overrides
TextBox_HandlerChanged(Object, EventArgs)
Handles changes to the TextBox control in a .NET MAUI application. This method is triggered whenever the TextBox's state changes, allowing for custom behavior in response to those changes.
Declaration
protected override void TextBox_HandlerChanged(object sender, EventArgs e)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Object | sender | The source of the event, typically the TextBox.  | 
      
| System.EventArgs | e | Event arguments containing data related to the change event.  |