OK, I don't get what's wrong here. Here's the CustomerName in my CustomerView
Here's the VM
private void Customer_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
IsChanged = true;
ValidateCustomerName();
}
private void ValidateCustomerName()
{
ClearErrors(nameof(Customer.CustomerName));
if (string.IsNullOrWhiteSpace(Customer.CustomerName))
{
AddError(nameof(Customer.CustomerName), "The Customer Name cannot be empty.");
}
}
When I clear out the CustomerName field, the ValidateCustomerName method fires, and the error is added to the errors collection. I just don't see the error text on the UI. However, if instead of binding to Customer.CustomerName, if I put a string property on the VM called CustomerName and use that, then I see the error text.
In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.