Category / Section
How to configure a certain currency symbol in Xamarin.controls with numbers on forms?
2 mins read
The numeric text box or numeric up-down controls can have a custom string in its value. It can be specified by setting the “FormatString” property.
Setting the custom string
Change the ‘FormatString’ property of SfNumericUpDown or SfNumericTextBox with custom format string, e.g., USD 0.00. For more available custom formats, refer to this documentation.
Code Snippet [C#]:
namespace CustomCurrency_Numeric { public partial class MainPage : ContentPage { public MainPage() { InitializeComponent(); …. SfNumericUpDown numericUpDown = new SfNumericUpDown() { … Value = 100, FormatString = "USD 0.00", … }; … SfNumericTextBox numericTextBox = new SfNumericTextBox() { … Value = 1000, FormatString = "USD 0.00", … }; … } } }
Code Snippet [XAML]:
<Grid> … <upDown:SfNumericUpDown Grid.Row="1" Value="100" FormatString="USD 0.00"/> … <textBox:SfNumericTextBox Grid.Row="3" Value="1000" FormatString="USD 0.00"/> </Grid>
Output: