title: Updating content between tabs binded by Preference
body: <p>I am using a tabbed app and I have a button on one tab, when the user clicks then it increments a Preference and I want to update its value on another tab that is Binded to a label. I tried to experiment with MVVM but I couldnt figure it out.</p>
  <p>Page 1 view:</p>
  <pre><code>  public partial class Page1View: ContentPage
       {
           public Page1View()
           {
               InitializeComponent();
           }
      
           private void Button_Clicked(object sender, EventArgs e)
           {
               Preferences.Set(&quot;Total&quot;, Preferences.Get(&quot;Total&quot;, 0)+1);
           }
       }
  </code></pre>
  <p>Page 2 Viewmodule:</p>
  <pre><code> public class Page2ViewModule : INotifyPropertyChanged
       {
           public int Total
           {
               get =&gt; Preferences.Get(nameof(Total), 0);
               set
               {
                   if (Preferences.Get(nameof(Total),0) == value)
                       return;
                   Preferences.Set(nameof(Total), value);
                   OnPropertyChanged(nameof(Total));
               }
           }
           public event PropertyChangedEventHandler PropertyChanged;
           protected virtual void OnPropertyChanged(string propertyName)
           {
               var changed = PropertyChanged;
               if (changed != null)
               {
                   PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
               }
           }
       }
  </code></pre>
  <p>Here's what I done with MessagingCenter. On the button click event I sent a message like this:</p>
  <pre><code>private void Button_Clicked(object sender, EventArgs e)
  
  {
  
       Preferences.Set(&quot;Total&quot;, Preferences.Get(&quot;Total&quot;, 0)+1);
  
       MessagingCenter.Send&lt;Page&gt;(this, &quot;test&quot;);
  
  }
  </code></pre>
  <p>In the Page2 view module I added a constructor that subscribes to message:</p>
  <pre><code>public Page2ViewModule()
  
  {
  
      MessagingCenter.Subscribe&lt;Page&gt;(this, &quot;test&quot;, (p) =&gt;
  
      {
  
           Total = Preferences.Get(nameof(Total), 0);
  
      });
  
  }
  </code></pre>
  <p>And that still doesn't work. But I'm not sure would this be the best way to do it? Or is there a more efficient way?</p>