ValidatesOnDataError not working

Topics: Framework Services, Getting Started, UI Architecture
Aug 1, 2011 at 9:54 PM

Hi, I have the following scenario in my Silverlight project:

I have a base class Person inheriting from PropertyChangedBase: public class Person : PropertyChangedBase

Furthermore, I have classes inheriting from Person like: public class Customer : Person

In Person base class I have a required property like

      private string _name;
      [Required(ErrorMessage = "Name is required")]
      public string Name
         get { return _name; }
            _name = value;

In my view I bind to "Customer.Name" and set ValidatesOnDataErrors=True. Everything works but validating if field "Name" is empty does not work, i.e. no red border and message.

If I explicitly create same name property within my view model and bind to this, validation is working.

What is wrong with my solution? Shouldn't errors "bubble up"? Or is inheritance in general a problem?