Last active
February 22, 2021 14:11
-
-
Save sthewissen/f7e5710fb9b9f83e1868d9eaa3fad138 to your computer and use it in GitHub Desktop.
MyDatePickerRenderer.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
How to make the DatePicker get also the selected time? Also, how to add a "Done" button to this?
Thanks in advance