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.
Unfortunately, activation email could not send to your email. Please try again.

Enable Return key

Thread ID:

Created:

Updated:

Platform:

Replies:

129642 Mar 27,2017 08:05 AM Mar 29,2017 12:51 PM Xamarin.Forms 3
loading
Tags: SfNumericTextBox
Roy Cornelissen
Asked On March 27, 2017 08:05 AM

Hi,

I'm struggling to get the return key on the SfNumericTextBox to work properly. I want to dismiss the keyboard when I press the Return key. Both in Xamarin.Forms (using an Effect) and in Xamarin.iOS "classic". This is a simple version of my code:

                             var box = new SFNumericTextBox()
            {
                Frame = new CGRect(20, 20, 200, 200),
                ParserMode = SFNumericTextBoxParsers.Double,
                FormatString = "c",
                NumericTextBoxDelegate = new SFNumericTextBoxDelegate(),
                EnablesReturnKeyAutomatically = true
            };

            // once I set this, the textbox stops formatting numbers:
            box.ShouldReturn = (textField) =>
            {
                textField.ResignFirstResponder();
                return true;
            };
  

If I setup the ShouldReturn delegate, in the last line, the default behavior of the SfNumericTextBox seems to break. Now when I tap the text box, the currency symbol and formatting don't disappear and I can start typing any value including letters and symbols. So clearly these delegates should not be overwritten?

What is the proper way of enabling the Return key? I noticed that in Forms, the renderer automatically adds a Done button to the keyboard. Is this a workaround?

Vanaja  Annasamy [Syncfusion]
Replied On March 28, 2017 12:41 PM

 Hi Roy,

Thank you for contacting Syncfusion support.

In Xamarin.Forms, by default the keyboard will be disappeared while pressing the return key in Numeric text box.

In Xamarin.IOS, we have achieved your requirement “KeyBoard disappear while return key is pressed” in sample level. Please download the sample for the same from below link.

Sample: http://www.syncfusion.com/downloads/support/forum/129642/ze/SFNumericTextBox.iOS-750937093 

Please let us know if you have concern on this.

Regards,

Vanaja R.A.
 


Roy Cornelissen
Replied On March 28, 2017 02:04 PM

Hello Vanaja,

Thanks for your reply. Unfortunately your sample code project contains only empty classes. Perhaps something went wrong while zipping it?

We don't see the behaviour you mentioned in Forms, if we press the Return key, nothing happens in our Forms project. Any idea what could be causing this? This is how our Xaml looks for all our numeric text boxes:

<num:SfNumericTextBox Style="{DynamicResource NumericTextBox}" IsEnabled="{Binding FinancialAmountFieldInfo.Enabled}" FormatString="c" Culture="{Binding CurrentCulture}" Value="{Binding FinancialAmountValue}" AllowNull="true" MaximumNumberDecimalDigits="2" ParserMode="Double" />
                                    
 
The style referenced is as follows:

    <Style TargetType="num:SfNumericTextBox" x:Key="NumericTextBox">
        <Setter Property="FontSize" Value="16" />
        <Setter Property="VerticalOptions" Value="FillAndExpand" />
        <Setter Property="HorizontalOptions" Value="FillAndExpand" />
        <Setter Property="Margin" Value="0,0,16,0" />
        <Setter Property="BackgroundColor" Value="White" />
        <Setter Property="Watermark" Value="" />
        <Style.Triggers>
            <Trigger TargetType="num:SfNumericTextBox" Property="IsEnabled" Value="True">
                <Setter Property="TextColor" Value="{DynamicResource DefaultEditableTextColor}" />
            </Trigger>
            <Trigger TargetType="num:SfNumericTextBox" Property="IsEnabled" Value="False">
                <Setter Property="TextColor" Value="{DynamicResource DefaultLabelColor}" />
            </Trigger>
        </Style.Triggers>
    </Style>

Vanaja  Annasamy [Syncfusion]
Replied On March 29, 2017 12:51 PM

Hi Roy,

Sorry for your inconvenience.

Query: Return key support in SfNumericTextBox.

Since SfNumericTextBox is derived from Entry in Xamarin.iOS it exhibits the default behavior of Entry, so we have to add the return key manually. As per your requirement we have created a sample which provide return key (Done) support. Please download the same from below link.

Link: http://www.syncfusion.com/downloads/support/forum/129642/ze/NumericTextBoxiOS1008031520 

Please let us know if you have concern on this.

Regards,
Vanaja R.A. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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.

;