title: How to change TimeFormat depending on system setting in Xamarin
body: <p>I updated Xamarin.Forms to the latest version 4.8.0.1560. I managed to bind the timepicker on both Android and iOS. The only discrepancy with my application is when the user use 24 time setting in their phone the time picker &quot;stuck&quot; in 12 hour format.</p>
  <p>In order to do that I created a custom renderer in iOS</p>
  <pre><code>[assembly: ExportRenderer(typeof(TimePicker), typeof(TimeRenderer))]
  namespace TabsApp.iOS.custom.renderers
  {
      public class TimeRenderer : TimePickerRenderer
      {
  
          protected override void OnElementChanged(ElementChangedEventArgs&lt;TimePicker&gt; e)
          {
              base.OnElementChanged(e);
              int hours = Element.Time.Hours;
              int minutes = Element.Time.Minutes;
  
              if (!Is12Hours())
              {
                  var timePicker = (UIDatePicker)Control.InputView;  
                  timePicker.Locale = new NSLocale(&quot;no_nb&quot;);  
              }
              
              string format = Is12Hours()?&quot;hh:mm tt&quot;:&quot;HH:mm&quot;;
              DateTime currTime = DateTime.Now;
              currTime = new DateTime(currTime.Year,currTime.Month,currTime.Day,hours,minutes,0);
              Control.Text = currTime.ToString(format);
            
          }
          
          
          
          private bool Is12Hours()
          {
              var dateFormatter = new NSDateFormatter();
              dateFormatter.DateStyle = NSDateFormatterStyle.None;
              dateFormatter.TimeStyle = NSDateFormatterStyle.Short;
  
              var dateString = dateFormatter.ToString(NSDate.Now);
              var isTwelveHourFormat = 
                  dateString.Contains(dateFormatter.AMSymbol) || 
                  dateString.Contains(dateFormatter.PMSymbol);
              return isTwelveHourFormat;
          }
      }
  }
  </code></pre>
  <p>OnElementChanged is being called once the application is loaded, and it will show the correct time format. When you change the time, this callback is not being called. Do I need to override other functions?
  <a href="https://i.stack.imgur.com/mI3f8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mI3f8.jpg" alt="sample" /></a></p>