Forum Cross Platform with Xamarin

Overriding device locale for datepicker using renderer in iOS


My application contain two languages. 1) English & 2) German.

User can change the language from application setting.

So for localize datpicker, I have created custom datepicker renderer.

[assembly: ExportRenderer(typeof(DatePicker), typeof(MyDatePickerRenderer))]
namespace Project.XamarinForm.iOS.Renderers
    public class MyDatePickerRenderer : DatePickerRenderer
        protected override void OnElementChanged(ElementChangedEventArgs<DatePicker> e)
            var datePicker = (UIDatePicker)Control.InputView;
            string selectedLanguage=App.CurrentApp.SelectedLangualge;
            datePicker.Locale = new NSLocale(selectedLanguage);

so when any user change the language (English to German) from application setting SelectedLangualge property changed.

When i open datepicker then it shows only in english language.

When i close application and run again then system shows in German language.

So here what is the issue?

Let me know if i missing anything.

Thanks in advance.


  • B_XDevB_XDev Member

    Hi fenilbhoot,

    seems like you already found this thread: https: // regarding the problem of localizing your datepickers. (Can't post the link as real link yet, just remove the whitespaces)

    I'm not sure if your string selectedLanguage actually contains the correct name. In the thread mentioned above they use the TwoLetterISOLanguageName. Maybe check if the string returned by App.CurrentApp.SelectedLanguage is the actual TwoLetterISOLanguageName and not the full name of the language. My assumption is that the app uses the default or settings if it doesn't know the language name.

    Hope this helps.

Sign In or Register to comment.