Response to: I got this error string was not recognized as a valid datetime when I validate WPF DatePicker control
Revision 2
I solved this like that:
<mytoolkit:datepicker grid.row="4" grid.column="4" x:name="clndrHiredate" horizontalalignment="Left" height="20" xmlns:x="#unknown" xmlns:mytoolkit="#unknown">
Width="150" VerticalAlignment="Top" FontFamily="Tahoma" FontWeight="Light" FlowDirection="RightToLeft"/>
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.clndrHiredate.SelectedDate = Convert.ToDateTime(DateTime.Now.ToString("MM/dd/yyyy"));
}
private void btnRead_Click(object sender, RoutedEventArgs e)
{
if (clndrHiredate.SelectedDate == null)
errorText += MessageBox.show("Wrong");
state = true;
lblHireDate.Visibility = Visibility.Visible;
}
else
{
}
}</mytoolkit:datepicker>
[edit]code block added[/edit]
Posted 11-Nov-12 2:18am
by
Doudy_2020.