I had the datepicker to have its selected date property bound to the dataset as shown in the XAML below:
<DatePicker x:Name="date_picker" Margin="0,0,0.2,0" SelectedDate="{Binding Date, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, StringFormat=dd-MM-yyyy}" ToolTip="Please select a date" FirstDayOfWeek="Monday" SelectedDateFormat="Short" DisplayDateStart="2013-01-01" DisplayDateEnd="2020-01-01" />
But when the window loads, I wanted the default output to be today's date instead of the default"Select a date", but when I use the code below, i just get the default "select a date". I think it may be because SelectedDate property is used twice. How would i fix this problem?
date_picker.SelectedDate = DateTime.Today;