Issue with decimal point and minus key on Samsung devices

Hy,

I want to use SfNumericEntry in my App to enter decimal percent value like, for example in Xaml:

<VerticalStackLayout Margin="5">

    <syncfusioncore:SfTextInputLayout

        Hint="Insert percent value (%)">

        <editors:SfNumericEntry Value="{Binding PercentValue, Mode=TwoWay}" CustomFormat="p2" UpDownPlacementMode="Inline" SmallChange="0.005" ShowClearButton="True" />

    </syncfusioncore:SfTextInputLayout>

</VerticalStackLayout>

it works fine on android emulator but when run it on my Samsung S21 device I can't insert decimal point (or comma) and minus (I need to use also negative values).

 I have found that this issue also is present in Xamarin Forms and below link offer a solution to workaround it:

How to resolve the issue with decimal point and minus key on Samsung devices in SfNumericTextBox | Syncfusion

I have tried to reproduce in Maui but SfNumeriEntry don't have a renderer.

What can I do?

Thanks Rolando


8 Replies

JK Jeya Kasipandi Syncfusion Team September 11, 2023 01:33 PM UTC

Hi Rolando Tonin,

We recommend that you set the keyboard to numeric entry in size changed event as in the code snippet below to resolve the reported issue. We have created the sample based on this and attached it for your reference.

Please refer to the below code snippet for this


  public MainPage()
  {
      InitializeComponent();
      this.BindingContext = new ViewModel();
      this.SizeChanged += MainPage_SizeChanged;
   
  }

  private void MainPage_SizeChanged(object sender, EventArgs e)
  {
 // Change the keyboard in numeric entry
      if ((numericEntry.Children[0] as Entry) != null)
      {
          (numericEntry.Children[0] as Entry).Keyboard = Keyboard.Telephone;
      }
  }


Please check the attached sample and let us know if you need any other details.

Regards,
Jeya K

Attachment: NumericEntrySample_1e42f240.zip


RT Rolando Tonin September 16, 2023 07:17 AM UTC

Hy Jeya,


this workaround seems to work right on Samsung phone devices. To solve it so I don't repeat above code on every page that use SfnumericEntry, I could create a new control, derived from SfNumericEntry and manage the event OnSizeChanged. 

what do you think about it?


thanks a lot.

Rolando Tonin



AJ AhamedAliNishad JahirHussain Syncfusion Team September 19, 2023 11:15 AM UTC

Hi Rolando,


We have reviewed your query and would like to inform you that you can utilize a custom control derived from SfNumericEntry. This custom control allows you to handle the SizeChanged event method, thereby avoiding the need to duplicate code on every page where you wish to employ the SfNumericEntry control in .NET MAUI. We have prepared a sample based on your requirements. Kindly review the attached sample and let us know the details.


Code Snippet :


  public class SfNumericCustom : SfNumericEntry

    {

        public SfNumericCustom()

        {

 

            this.BackgroundColor = Colors.Transparent;

            this.SizeChanged += SfNumericCustom_SizeChanged;

        }

 

        private void SfNumericCustom_SizeChanged(object sender, EventArgs e)

        {

            if ((this.Children[0] as Entry) != null)

            {

                (this.Children[0] as Entry).Keyboard = Keyboard.Telephone;

            }

        }

 

      

    }


Regards,

Ahamed Ali Nishad.


Attachment: NumericEntrySample_1e42f240_(2)_3c911b83.zip


DS David Speak replied to AhamedAliNishad JahirHussain April 2, 2024 07:52 AM UTC

Hi, 

I also have this problem, and setting the keyboard to "telephone" as per the custom control does enable me to enter a minus sign on Samsung phones (with a lot of fiddling).

However it looks very strange in my app (a math equation solver)!

Are you looking at fixing the underlying problem so I can use a "numeric" keyboard on a Samsung device?

The minus sign work fine on Samsung phones on other apps (e.g. fncalculator.com) ...

Many thanks,

David Speak.



AJ AhamedAliNishad JahirHussain Syncfusion Team April 3, 2024 03:10 PM UTC

Hi David,

 

We have reviewed your query and would like to inform you that it is not related to the Syncfusion issue. The keyboard issue also occurs when using controls such as Entry and Editor in .NET MAUI. Since it is the native Android keyboard, the layout changes based on the operating system. Therefore, it is not possible to fix it at our end. Currently, we have one workaround as suggested in the previous update.

 

Regards,

Ahamed Ali Nishad.



DS David Speak replied to AhamedAliNishad JahirHussain April 16, 2024 08:36 AM UTC

Hi Ahamed,

Sorry to bother you again, but I think we may be discussing a different problem.

Using VS2022 latest, testing on a Samsung S20 …

The number keyboard is shown correctly when using a SfNumericEntry control, and when using a maui Entry control with keyboard set to numeric.

On the Entry control, when on the first character, I can single click the combined "." and "-" keyboard button and the control has a decimal point. A double click changes it to a minus sign so I can enter negative numbers. 

On the SfNumericEntry control, when on the first character, I can single click the combined "." and "-" keyboard button and the control has a decimal point. A double click does not change to a minus sign so I cannot enter negative numbers.

            <Label Text="Maui Entry: can enter -1 OK"/>

            <Entry Keyboard="Numeric"/>


            <Label Text="SfNumericEntry: cannot enter -1 ??"/>

            <editors:SfNumericEntry />


I've attached a simple sample and screenshot for your info.

If it works with a Maui Entry control, couldn't it work with a SfNumericControl

Many thanks again,

David.



Attachment: MauiApp6_b3733e7a.zip


DS David Speak replied to David Speak April 16, 2024 08:38 AM UTC

Sorry didn't know I can only upload one file per post - screenshot attached …


Attachment: Screenshot_20240416_091051_44bf9c4.zip


PI Prithis Iyyappan Syncfusion Team November 25, 2024 10:51 AM UTC

Hi David Speak,

 

We have already included the fix for the reported issue "Cannot enter minus sign initially in SfNumericEntry on Samsung device" in our earlier weekly release. Please install the latest NuGet, which is available for download (NuGet). We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you require any further assistance.

 

Regards,

Prithis I.


Loader.
Up arrow icon