Xamarin forms, working with a OnPropertyChanged with a INT value
<p>I have one button on my <code>MasterDetailPage</code> changing the value on an INT (named App.value1) depending on what you click looking like this:</p>

<pre><code>void click1 (object s, EventArgs a)
{
    if (App.value1 == 0) {

        App.value1 = App.value1 + 1;

    } else {
        App.value1 = 0;
    }
}
</code></pre>

<p>And I want this click function to immediately change the value on my StartPage (another <code>ContentPage</code>). So I have created a viewmodel looking like this, where I try to work with the current value:</p>

<pre><code>public event PropertyChangedEventHandler PropertyChanged;

protected virtual void OnPropertyChanged (string propertyName)
{
    var changed = PropertyChanged;
    if (changed != null) {

        PropertyChanged (this, new PropertyChangedEventArgs (propertyName));    
    }
}

public int currentValue {

        get {
            return App.value1;  
        }

        set {

            if (App.value1 == 0) {
                App.value1 = 0;

            } else {

                App.value1 = 1;
            }

        }   


    }
</code></pre>

<p>And this is the <code>StartPage</code> where I want the value of the INT to update immediately depending on what you clicked on at the <code>MasterDetailView</code>.</p>

<pre><code>public StartPage ()
{
        var ourView = new StartPageViewModel ();

        ourCurrentValue = ourView.currentValue;
}

protected async override void OnAppearing() 
{
    LoadData();
}


private async Task&lt;List&lt;Pin&gt;&gt; LoadData() //I work with pins here (not showing that code though as it is irrelavant.
{
    if (ourCurrentValue == 0) {
        System.Diagnostics.Debug.WriteLine ("Value is 0");
    }

    else {
        System.Diagnostics.Debug.WriteLine ("Value is 1");
    }
}
</code></pre>

<p>Right now I only see "Value is 0" in my log. Nothing updates when I click on my button on the <code>MasterDetailPage</code>.</p>

<p>UPDATED CODE:</p>

<pre><code>public class StartPageViewModel : INotifyPropertyChanged
{
    private ICommand clickCommand;
    private int currentValue;

    public  event PropertyChangedEventHandler PropertyChanged;

    protected virtual void OnPropertyChanged (string propertyName)
    {
        var changed = PropertyChanged;
        if (changed != null) 
        {
            PropertyChanged (this, new PropertyChangedEventArgs (propertyName));    
        }
    }


    public StartPageViewModel()
    {
        ClickCommand = new Command(() =&gt; CurrentValue = CurrentValue + 1);
    }

    public ICommand ClickCommand 
    {
        get { return clickCommand; }
        set
        {
            clickCommand = value;
            OnPropertyChanged("ClickCommand");
        }
    }
    public int CurrentValue 
    {
        get { return currentValue; }
        set
        {
            currentValue = value;
            OnPropertyChanged("CurrentValue");
        }
    }

}
</code></pre>

<p>And StartPage:</p>

<pre><code>public StartPage ()
    {
        App.PropertyChanged += (sender, args) =&gt; OnPropertyChanged("currentValue"); // ERROR: `An object reference is requiered to access non-static member 'Xamarin.Forms.BindableObject.PropertyChanged`
    }
</code></pre>