简体   繁体   中英

how can I get a date from the user in Windows Phone?

I should get a date from the user inside a WP 8.1 app, I need something like the DateTimePicker which I use in Windows Forms or the DatePicker of WPF environment, do you know ho to do this?
I tried to search something similar to DatePicker in windows phone but I can't find anything!

My app should get this date to generate a fiscal code, so I need to get the user's birthday. Is there any tag to add to my xaml file?
Thanks a lot guys!

我想这会解决你的问题!

<DatePicker x:Name=birthdayDatePicker Header="Birthday Date"/>

The question is what kind of WP 8.1 app you're developing? Windows Runtime or Silverlight ? If the first one, then you can just use DatePicker control, because it's built in.

But, if your app uses Silverlight , then you have to import Windows Phone Toolkit first. You can do it easily: right-click on your project name in Solution Explorer , then choose Manage NuGet Packages... . Type wptoolkit in a search box and you will find Windows Phone Toolkit . Just install it. Now, go to you XAML code and add toolkit namespace:

xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"    

Now you can add DatePicker to your layout:

<toolkit:DatePicker Header="Birthday date"/>

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