I am trying to enter a valid date in a specified format in a text-box. Can anyone help me to validate the date is entered in a text box is a valid date and its in a DD/MM/YYYY format?
If its not a valid date entered by a user then after pressing tab (click outside from textbox) it should say: date wrongly entered.
View Model:
private DateTime? _txtDateDeRec;
public DateTime? TxtDateDeRec
{
get
{
return this._txtDateDeRec;
}
set
{
this._txtDateDeRec = value;
OnPropertyChanged("TxtDateDeRec");
}
}
XAML Code is:
TextBox x:Name="txtDateDeRec" HorizontalAlignment="Left" Height="23" Margin="555,65,0,0" TextWrapping="Wrap" Text="{Binding TxtDateDeRec}" VerticalAlignment="Top" Width="163"