How to open the DatePicker/TimePicker dialog in code? #7410
Replies: 4 comments 12 replies
-
I'm having the same problem. I ported some Xamarin code that used |
Beta Was this translation helpful? Give feedback.
-
I have found a way to open the date picker, Android's native View class (Android.Views) have a method called PerformClick which allows opening the date picker without pressing the DatePicker and TimePicker, I leave you an example of how I did it in case it can help someone in the same situation. I have made a small example in which I have a DatePicker, when the user clicks on it the date picker appears, when we select a date from the picker and click "OK" the DateSelected event is fired and this is where the magic is done to access the TimePicker Handler and thus be able to access the native "PerformClick" method to open the TimePicker time selector without having to click on it: XAML:
Code-behind:
|
Beta Was this translation helpful? Give feedback.
-
This is still an issue in .Net 8. Will there be a fix? |
Beta Was this translation helpful? Give feedback.
-
Is there any solution for Windows? |
Beta Was this translation helpful? Give feedback.
-
I'm trying to create a custom DateTimerPicker control where you select both date and time to update an entry. Both the DatePicker and TimePicker are not visible and I'm trying to get both controls' dialogs to open but I can't seem to find a way. I tried with .Focus() but it doesn't seem to work.
Beta Was this translation helpful? Give feedback.
All reactions