2016-09-16 122 views
0

使用Prism和Fody.PropertyChanged是否有任何限制?与Prism和Fody一起使用Xamarin.Forms

我想使用Fody在我的ViewModel变量实现OnPropertyChange,但它不工作。物业更改不发射。

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

该FodyWeavers配置PropertyChanged

任何想法?

编辑:

我想用Fody的的PropertyChanged避免在我的视图模型上的每个属性此代码:

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; 
} 
+0

你想要达到什么样的目标? – BraveHeart

+0

你可以发布你的视图模型类的代码吗?我使用棱镜和实体,他们工作得很好。 –

回答

4

我认为这个问题是你已经在游览类中实现了字段而不是属性。 Try:

[ImplementPropertyChanged] 
public class AlterarPerfilPageViewModel : BindableBase, INavigationAware 
{ 
    public People Pessoa {get; set;} 
    public bool IsBusy {get; set;}; 
} 
+0

这里你不需要BindableBase,如果你使用的是Fody –

相关问题