Wonderingly
Wonderingly

Reputation: 41

Windows phone: date picker and button

Is it possible to have a hidden date picker in windows phone and show it with a button. I have this code

InitializeComponent();
this.datePicker1.ValueChanged += new EventHandler<DateTimeValueChangedEventArgs>(datePicker1_ValueChanged);
DateTime date = DateTime.Today;
button1.Content = date.ToShortDateString();
...

private void datePicker1_ValueChanged(object sender, DateTimeValueChangedEventArgs e)
{
    DateTime date1 = (DateTime)e.NewDateTime;
    button1.Content = date1.ToShortDateString();
}

but how do I launch the date picker with the button.

Upvotes: 2

Views: 4720

Answers (1)

Agat
Agat

Reputation: 4779

Just use custom (and cool) date/time pickers from Windows Phone Toolkit like here.

Upvotes: 1

Related Questions