如何使用Fody从模型拦截到 ViewModel ?
我试着把它放在我的 ViewModel 中,但什么也没发生,我错过了什么吗? 我正在使用 Xamarin 表单,棱镜 模型
public class Question : INotifyPropertyChanged
{
public bool IsValid { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
public virtual void OnPropertyChanged(string propertyName)
{
Debug.WriteLine("This Works Here :) ");
var propertyChanged = PropertyChanged;
if (propertyChanged != null)
{
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
视图模型
public class MainPageViewModel : INavigationAware, INotifyPropertyChanged{
public virtual void OnPropertyChanged(string propertyName)
{
Debug.WriteLine("It Does not reach here :( ");
}
public static void Intercept(object target, Action onPropertyChangedAction, string propertyName)
{
Debug.WriteLine("It Does not reach here too :( ");
onPropertyChangedAction();
}
}
我需要使用PropertyChangedNotificationInterceptor吗?如何在我的 View-Model 中实现它,任何建议都会很棒
[更新]