The selected date in the DatePicker bind to the property in the viewmodel.

 <DatePicker SelectedDate="{Binding RegistrationDate}" /> 

The problem is that when you start the program, the date is displayed like this:

enter image description here

How to clear the date from the input field, if it is equal to the default value?

I tried to check through the converter and return null , but this does not work.

    1 answer 1

    This answer helped.

    It turns out you had to work with the Text property. Hung up the event handler on SelectedDateChanged and there I reset the Text :

     private void datePicker1_SelectedDateChanged(object sender, SelectionChangedEventArgs e) { if (datePicker1?.SelectedDate == new DateTime()) { datePicker1.Text = null; datePicker1.DisplayDate = DateTime.Now; } }