Updating Dates with WPF DatePicker

I spent hours and hours trying to find this piece of information. Finally I was very happy to have Julia Kornich, a technical writer on the EF team, save the day!

By default a DatePicker control does not notify it’s datasource of changes.

Even when you are doing a drag & drop application.

I had a DataGrid where every column but the date columns was pushing changes back to the database.

What was wrong with the DatePicker?

You need to explicitly tell it to do the job with the UpdateSourceTrigger attribute. It is not in the XAML by default. And in order for the notification to happen when the user changes the date, the UpdateSourceTrigger needs to be set to PropertyChanged.

   SelectedDate="{Binding Path=OrderDate, Mode=TwoWay, 


And there you have it!

  Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!  

5 thoughts on “Updating Dates with WPF DatePicker

  1. Wow,

    I’m assuming there’s good reason why they did not make this the default.
    But this is a serious divergence from the default settings of the rest of the controls.
    This post saved me many hours, too. I’m so glad I found this without a lot of looking.

    Thanks Julie!

  2. There is another issue with DatePicker, that if the user typed the date instead of selecting it from the calendar, then the value of the SelectedDate is not updated until lost of focus occur, even if I specified UpdateSourceTrigger=PropertyChanged, did anyone find a solution for that?

    1. I haven’t revisited this in a long time and there have been multiple new versions since. Maybe someone will come along that can answer.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.