Xamarin Prism 模型到 ViewModel Fody
Xamarin Prism Model to ViewModel Fody
如何使用 Fody 从模型拦截到 ViewModel?
我尝试将其放入我的 ViewModel 但没有任何反应,我是不是遗漏了什么?
我正在使用 Xamarin Forms,Prism
型号
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));
}
}
}
ViewModel
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 中实现它,任何建议都很棒
[更新]
在 fody 属性 中,更改的调用就这么简单:
public string Text{ get; set; }
public void OnTextChanged()
{
}
如何使用 Fody 从模型拦截到 ViewModel?
我尝试将其放入我的 ViewModel 但没有任何反应,我是不是遗漏了什么? 我正在使用 Xamarin Forms,Prism 型号
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));
}
}
}
ViewModel
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 中实现它,任何建议都很棒
[更新]
在 fody 属性 中,更改的调用就这么简单:
public string Text{ get; set; }
public void OnTextChanged()
{
}