title: PropertyChanged WPF MVVM Light
body: <p>I am using MVVM light in WPF. The Model class properties are constantly changed due to changes of the underlying data-access layer.</p>
  
  <p>Model:</p>
  
  <pre><code>public class SBE_V1_Model : ViewModelBase
  {
      public SBE_V1_Model(String name)
      {
          Name = "MAIN." + name;
          SetupClient();
      }
      private void SetupClient()
      {
          client =  new ConnectionHelper(this);
          client.Connect(Name);
  
      }
      public Boolean Output
      {
          get
          {
              return _Output;
          }
          set
          {
              if (value != this._Output)
              {
                  Boolean oldValue = _Output;
                  _Output = value;
                  RaisePropertyChanged("Output", oldValue, value, true);
              }
          }
      }
  }
  </code></pre>
  
  <p>If <code>Output</code> property changes, then bindings will be notified, so this works. But what is the correct way to update the property from the data-access source, which knows the new value?</p>
  
  <pre><code>public class ConnectionHelper : ViewModelBase
  {
     public Boolean Connect(String name)
      {
          Name = name;
          tcClient = new TcAdsClient();
  
          try
          {
              dataStream = new AdsStream(4);
              binReader = new AdsBinaryReader(dataStream);
              tcClient.Connect(851);
              SetupADSNotifications();
              return true;
          }
          catch (Exception ee)
          {
              return false;
          }
      }
      private void tcClient_OnNotification(object sender, AdsNotificationEventArgs e)
      {
          String prop;
          notifications.TryGetValue(e.NotificationHandle, out prop);
          switch (prop)
          {
              case "Output":
                  Boolean b = binReader.ReadBoolean();
                  RaisePropertyChanged("Output", false,b, true);
                  break;
       }
     }
   }
  </code></pre>
  
  <p>Why doesnt the <code>RaisePropertyChanged</code> call in connectionhelper update the property of the model? If this is the wrong way, should I set up some kind of listener?</p>