none
As show the symbol of the dollar, pound in a textblock RRS feed

  • Question

  • hello:

    As I can show the symbol of the dollar, pound in a textblock for the different languages with switch or with if

    Sunday, November 6, 2016 4:34 PM

All replies

  • myTextBlock.Text = 1234.56.ToString("C");  Should put the localized currency symbol in the textblock.   
    Sunday, November 6, 2016 6:02 PM
  • Hi Javier,

    If you want to display a currency for a particular currency system, you may use the NumberFormatting.CurrencyFormatter API.
    https://msdn.microsoft.com/en-us/windows/uwp/globalizing/use-global-ready-formats

        // This scenario uses the Windows.Globalization.NumberFormatting.CurrencyFormatter class
        // to format a number as a currency.
    
        // Determine the current user's default currency.
        var userCurrency = Windows.System.UserProfile.GlobalizationPreferences.Currencies[0];
    
        // Number to be formatted.
        var fractionalNumber = 12345.67;
    
        // Currency formatter using the current user's preference settings for number formatting.
        var userCurrencyFormat = new Windows.Globalization.NumberFormatting.CurrencyFormatter(userCurrency);
        var currencyDefault = userCurrencyFormat.Format(fractionalNumber);
    
        // Create a formatter initialized to a specific currency,
        // in this case US Dollar (specified as an ISO 4217 code) 
        // but with the default number formatting for the current user.
        var currencyFormatUSD = new Windows.Globalization.NumberFormatting.CurrencyFormatter("USD"); 
        var currencyUSD = currencyFormatUSD.Format(fractionalNumber);
    
        // Create a formatter initialized to a specific currency.
        // In this case it's the Euro with the default number formatting for France.
        var currencyFormatEuroFR = new Windows.Globalization.NumberFormatting.CurrencyFormatter("EUR", new[] { "fr-FR" }, "FR");
        var currencyEuroFR = currencyFormatEuroFR.Format(fractionalNumber);
    
        // Results for display.
        var results = "Fixed number (" + fractionalNumber + ")\n" +
                      "With user's default currency: " + currencyDefault + "\n" +
                      "Formatted US Dollar: " + currencyUSD + "\n" +
                      "Formatted Euro (fr-FR defaults): " + currencyEuroFR;
    
    Best Regards,
    David

     

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, November 15, 2016 10:23 AM
  • Hi:

    f I have several format of coins as I can get in the TextBlock and also as I can do in other boxes out liters, Miles and mile.

    Wednesday, May 15, 2019 12:58 PM
  • Wednesday, May 22, 2019 6:03 PM