Return Type in Xamarin Numeric Entry (SfNumericTextBox)

16 Oct 2020 / 2 minutes to read

We can able to define the return key type of NumericTextBox by using the ReturnType property of the type Xamarin.Forms ReturnType.

<syncfusion:SfNumericTextBox x:Name="numericTextBox" ReturnType= "Next" Value="123" />
SfNumericTextBox numericTextBox = new SfNumericTextBox();
numericTextBox.ReturnType = ReturnType.Next;
numericTextBox.Value = 123;

NOTE

Default value of ReturnType is Default.

Return Command

The ReturnCommand property defines an ICommand implementation that wraps an action when the user presses return button.

Return Command Parameter

The ReturnCommandParameter property is used to set the parameter that is sent to the ReturnCommand.

<ContentPage.BindingContext>
    <local:ViewModel />
 </ContentPage.BindingContext>

	<syncfusion:SfNumericTextBox x:Name="numericTextBox" ReturnType="Next" Value="123" ReturnCommand="{Binding CommandProperty}" />
public class ViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged = delegate { };
        public ICommand CommandProperty { protected set; get; }
        public ViewModel()
        {
            CommandProperty = new Command(
                execute: () =>
                {
                    OnSubmit();
                },
                canExecute: () =>
                {
                    return true;
                });
        }
        
        private void OnSubmit()
        {

        }
    }

See also

How to get the localized return key on the iOS keyboard in SfNumericTextBox