I am using a couple of DatePickers in my UWP app and am unsure how to get the current value from it. Is there a simple way to do this?
The property you're looking for is Date.
If you've got your DatePicker in your XAML like this
<DatePicker x:Name="DatePicker" />
And want to access the date in the code-behind, you can do that like this
var date = this.DatePicker.Date;
You could also listen to the DateChanged event like this
this.DatePicker.DateChanged += (o, e) =>
{
var changedDate = e.NewDate;
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With