Set initial date to WPF Calendar control

Mar 17

In WPF, you can set the SelectedDate property to any DateTime value, but this value is not shown as initial date in the calendar control.

If you wish to set the initial date, you need to set the DisplayDate property.

If you use databinding, you can bind both values to the same property on the ViewModel, or to two different, what you like more. Of course in the latter case the initial value needs to be set to both properties.

Another suggestion: if you work with the Calendar control directly, you should embed it in a ViewBox control to have it adjusted when you resize your window.