简体   繁体   中英

C# WP8 Open TimePicker from code

How can I open the TimePicker to select new time but from C#? Not by tapping the control.

Is there any simple way to do that?

(I assume you mean the Windows Phone Toolkit TimePicker control here.)

From reading the source code of the DateTimePickerBase , it would seem not. Opening the picker page is done by the OpenPickerPage() method, which is private, and is only called from the OnDateButtonClick method, which is also private and handles the Click event on a private Button .

Of course, as the control is open-source, you can take the source code of the control and make your own copy of it with one of these methods exposed. As far as I can tell, it's allowed under the Ms-PL .

I had the same problem once. I solved it by forking the Windows Phone Toolkit and making the OpenPickerPage of the control public.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM