Search code examples
c#xamarin.formsfody-propertychanged

NotifyPropertyChanged not firing in derived class


I have these 3 classes

[AddINotifyPropertyChangedInterface]
public abstract class BaseViewModel
{

}

public abstract class XXXViewModelBase : BaseViewModel
{
   public int SelectedAreaId { get; set; }
}

public class XXXSelectorViewModel : XXXViewModelBase
{
    //public new int SelectedAreaId { get => base.SelectedAreaId; set => base.SelectedAreaId = value; }
    public void OnSelectedAreaIdChanged()
    {
        // Does not fire
    }
}

With the code as shown, OnSelectedAreaIdChanged does not fire when SelectedAreaId is changed. If I uncomment the code, then OnSelectedAreaIdChanged does fire.

Is that expected behaviour? Is there any way around this other than the way I've done it?


Solution

  • Yes it is expected behavior, because Fody doesn't support this. More Info Here