Xamarin Forms and PropertyChanged.Fody not updating UI

1.2k Views Asked by At

I have a Xamarin Forms project using MVVM in which I am attempting to use Fody and the PropertyChanged.Fody package. No matter what I try it simply does not work. I have spent the day searching for examples of projects using PropertyChanged.Fody and can't find any example sample code that actually works. Can someone help me out? Thanks.

I have added both Fody and PropertyChanged.Fody nugets to the project.

I have added the FodyWeavers.xml file to the Forms project which looks like...

<?xml version="1.0" encoding="utf-8"?>
<Weavers>
    <PropertyChanged />
</Weavers>

My view is a standard ContentPage...

<ContentPage.BindingContext>
    <viewmodels:GetStartedViewModel />
</ContentPage.BindingContext>
<ContentPage.Content>
    <StackLayout >
         <Entry Text="{Binding TestMessage}" TextColor="Lime" FontSize="20" /> 
    </StackLayout>
</ContentPage.Content>

I have tried implementing PropertyChanged.Fody on the ViewModel in 2 ways, both of which fail to work.

1)

public class GetStartedViewModel : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;
    public string TestMessage { get; set; }
}

2)

[AddINotifyPropertyChangedInterface]
public class GetStartedViewModel
{
    public string TestMessage { get; set; }
}
0

There are 0 best solutions below