Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

How to change the title of Timepicker and localization in custom renderer

$
0
0

I have Xamarin forms time picker following custom renderer for IOS

    [assembly: ExportRenderer(typeof(TimePicker), typeof(Time24PickerRenderer))]
    namespace LabOraTimeStamp.iOS.Renderers
    {
        public class Time24PickerRenderer:TimePickerRenderer
        {
            protected override void OnElementChanged(ElementChangedEventArgs<TimePicker> e)
            {
                base.OnElementChanged(e);
                var timePicker = (UIDatePicker)Control.InputView;
                timePicker.Locale = new NSLocale("no_nb");

                //Get the Done button
                var toolbar = (UIToolbar)Control.InputAccessoryView;
                var doneBtn = toolbar.Items[1];

                //Set the Done to OK
                doneBtn.Title = "OK";
            }
        }
    }

I wanted to change the default "done" to "Ok".

1) How can I do that? the line mentioned above for setting the title does not affect anything.

2) I already implemented localization for xamarin forms.I just wanted to use existing Resx values from custom renderer to show the string for appropriate culture.How can I achieve that?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>