2016-09-16 119 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 –

相關問題