1

使用 Prism 和 Fody.PropertyChanged 有什么限制吗?

我正在尝试使用 Fody 为我的 ViewModel 上的变量实现 OnPropertyChange,但它不起作用。属性更改没有触发。

我试图删除从我的类继承的 BindableBase 并继续相同。

FodyWeavers 配置了 PropertyChanged

有任何想法吗?

编辑:

我想使用 Fody 的 PropertyChanged 来避免在我的 ViewModel 上的每个属性上使用此代码:

private People pessoa;
public People Pessoa
{
    get { return pessoa; }
    set
    {
        if (pessoa == value) return;

        pessoa = value;
        OnPropertyChanged();
    }
}

private bool isBusy;
public bool IsBusy
{
    get { return isBusy; }
    set
    {
        if (isBusy == value) return;

        isBusy = value;
        OnPropertyChanged();
    }
}

像这样使用:

[ImplementPropertyChanged]
public class AlterarPerfilPageViewModel : BindableBase, INavigationAware
{
  public People Pessoa;
  public bool IsBusy;
}
4

1 回答 1

4

我认为问题在于您在旅游类而不是属性中实现了字段。尝试:

[ImplementPropertyChanged]
public class AlterarPerfilPageViewModel : BindableBase, INavigationAware
{
  public People Pessoa {get; set;}
  public bool IsBusy {get; set;};
}
于 2016-11-01T13:07:52.333 回答