Skip to content

Instantly share code, notes, and snippets.

@sthewissen
Last active February 22, 2021 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sthewissen/f7e5710fb9b9f83e1868d9eaa3fad138 to your computer and use it in GitHub Desktop.
Save sthewissen/f7e5710fb9b9f83e1868d9eaa3fad138 to your computer and use it in GitHub Desktop.
MyDatePickerRenderer.cs
[assembly: ExportRenderer(typeof(DatePicker), typeof(MyDatePickerRenderer))]
namespace MyProject.iOS.Renderers
{
public class MyDatePickerRenderer : DatePickerRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<DatePicker> e)
{
base.OnElementChanged(e);
if (e.NewElement != null && Control != null)
{
if (UIDevice.CurrentDevice.CheckSystemVersion(14, 0))
{
UIDatePicker picker = (UIDatePicker)Control.InputView;
picker.PreferredDatePickerStyle = UIDatePickerStyle.Wheels;
}
}
}
}
}
@flacidsnake
Copy link

Hi!
How to make the DatePicker get also the selected time? Also, how to add a "Done" button to this?

Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment