Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if DatePicker value is null

I would like to check if the value of a DatePicker is null (== no date in the box).

By default the Text of my DatePicker is set to something like Select a date, so I can't use the Text property to check.

like image 289
Rémy Kaloustian Avatar asked Mar 12 '16 12:03

Rémy Kaloustian


1 Answers

The DatePicker class has a property, SelectedDate, which enable you to get or set the selected date. If there is none selected, it means its value will be null.

if (datePicker.SelectedDate == null)
{
    // Do what you have to do
}
like image 99
Izukani Avatar answered Oct 04 '22 22:10

Izukani