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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Localized Formatting for SfNumericTexbox

Thread ID:

Created:

Updated:

Platform:

Replies:

146919 Aug 26,2019 05:58 AM UTC Sep 3,2019 11:00 AM UTC Xamarin.Forms 5
loading
Tags: SfNumericTextBox
Murat
Asked On August 26, 2019 05:58 AM UTC

I am using SfNumericTextbox but cannot handle formatting. 
I've written a helper and it works for label somehow, doesn't work for numerictextbox

What I want is to put; 
- comma as decimal delimiter, 
- dot as thousand delimiter 
- (optionally) binded symbol for currency 

Sample result I want to achieve; 1.500,25 

       <inputLayout:SfTextInputLayout
               Hint="Budget"
               ContainerType="Outlined" 
                ReserveSpaceForAssistiveLabels="False">
                    <numericBox:SfNumericTextBox Value="{Binding BudgetAmount, Mode=TwoWay, Converter={StaticResource numericLabelFormatConverter}}" />
       </inputLayout:SfTextInputLayout>


        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            double amount = System.Convert.ToDouble(value);
            return Math.Round(amount, 0).ToString("N0", new CultureInfo("tr-TR"));
        }

Thanks in advance for your kindly support. 

Rachel A [Syncfusion]
Replied On August 26, 2019 01:48 PM UTC

Hi Murat,

 
Greetings from Syncfusion.

 
You can achieve your requirement using the Culture property in the SfNumericUpDown control. Please refer the below code snippet for reference.

 
Code Snippet:

 
XAML 
 <inputLayout:SfTextInputLayout
               Hint="Budget"
               ContainerType="Outlined" 
                ReserveSpaceForAssistiveLabels="False">
                    <numericBox:SfNumericTextBox  MaximumNumberDecimalDigits="2" x:Name="numericTextBox" />
       </inputLayout:SfTextInputLayout>
 
 
 
C#: 
numericTextBox.Culture = new CultureInfo("tr-TR"); 
 
 
Screenshot:

 


 
Please let us know if you need further assistance on this.

 
Regards, 
Rachel. 
  


Murat
Replied On August 27, 2019 05:24 AM UTC

Thank you, Rachel. It worked currently. However, is there any other way if I use ViewModel behind content page? 

Because I need to change localization regarding to currency settings of user. So I want to check and set the culture in the ViewModel.cs (not in *.xaml.cs)

Rachel A [Syncfusion]
Replied On August 28, 2019 08:41 AM UTC

Hi Murat, 
 
We have modified the sample by declaring Culture property in the ViewModel as per your request. Please find the modified sample below. 
 
Sample: 
 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Rachel. 


Murat
Replied On September 3, 2019 10:56 AM UTC

I really appreciate it, Rachel.  

It's definitely worked. 


Rachel A [Syncfusion]
Replied On September 3, 2019 11:00 AM UTC

Hi Murat, 
 
Thanks for the confirmation. 
 
Please let us know if you have any other queries. 
 
Thanks, 
Rachel. 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon