What is the possible reason whereby the validation is not working?
public class DatabaseObj : ValidatableModel, IFormattable
{
[Required(ErrorMessage="Hostname is required")]
public string Hostname
{
get { return _hostname; }
set { SetProperty(ref _hostname, value); }
}
}
[Serializable]
public abstract class ValidatableModel : Model, INotifyDataErrorInfo
{
}
[Serializable]
public abstract class Model : INotifyPropertyChanged
{
}
In xaml,
<TextBox Text="{Binding DatabaseObj.Hostname, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=true, NotifyOnValidationError=true}"
Grid.Column="1" Grid.Row="1" Margin="0,1,91,10" HorizontalAlignment="Stretch"/>
However, when I compile and run, I empty the textbox and no error message is shown and color still remain same.
*Update for Object class