Regional formatting is the manner in which various information, such as currency, date, and time is displayed according to the different regions of the world. In this recipe, we will discuss how to display formatted numbers and dates according to the user's regional formatting settings.
Create a new Single View Application in Xamarin Studio and name it RegionalFormattingApp
.
Perform the following steps:
Add five labels on the view of
RegionalFormattingAppViewController
.Enter the following code in the
RegionalFormattingAppViewController
class:public override void ViewDidAppear (bool animated) { base.ViewDidAppear (animated); this.lblLocale.Text = string.Format("Locale: {0}", NSLocale.CurrentLocale.LocaleIdentifier); this.lblDate.Text = string.Format("Date: {0}", DateTime.Now.ToLongDateString()); this.lblTime.Text = string.Format("Time: {0}", DateTime.Now.ToLongTimeString()); this.lblCurrency.Text = string.Format("Currency: {0:c}", 250...