title: Passing data between View models using Prism Event Aggregator
body: <p>I have a user control whose <code>DataContext</code> is bound to its view model which should display <em>Status Messages</em> from any other <code>UserControl</code>s which are bound to their respective view models.</p>
  
  <p><em>Status Messages</em> is an <code>ObservableCollection&lt;StatusGridModel&gt;</code>. Now I am trying to use <code>EventAggregation</code> in order to pass this collection from my different view models to <code>StatusViewModel</code>.</p>
  
  <p>In the constructor of every view model I have <code>IEventAggregator</code> of Prism resolved by Unity. Now on <code>ButtonClick</code> in first <code>ViewModel</code> I am doing the following:</p>
  
  <pre><code>DashBoardStatusCol.Add(statusGridModel);
  eventAggregator.GetEvent&lt;StatusEvent&gt;().Publish(DashBoardStatusCol);
  </code></pre>
  
  <p>where <code>StatusEvent</code> class derives from <code>PubSubEvent</code></p>
  
  <pre><code>public class StatusEvent : PubSubEvent&lt;ObservableCollection&lt;StatusGridModel&gt;&gt;    
  {    
  }
  </code></pre>
  
  <p>Below is my second view model where the <em>Status Messages</em> should be displayed. I have subscribed to my <code>StatusEvent</code> class in the constructor.</p>
  
  <pre><code>public class StatusGridViewModel : ViewModelBase&lt;PresentationModel&gt;
  {
      IEventAggregator eventAggregator;
      public StatusGridViewModel(IEventAggregator eventAggregator)
      {
          this.eventAggregator = eventAggregator;
          this.eventAggregator.GetEvent&lt;StatusEvent&gt;().Subscribe(SetStatus, true);
      }        
  
      private void SetStatus(ObservableCollection&lt;StatusGridModel&gt; collection)
      {
          StatusCollection = collection;
      }
  
      private ObservableCollection&lt;StatusGridModel&gt; statusCollection;
  
      public ObservableCollection&lt;StatusGridModel&gt; StatusCollection
      {
          get { return statusCollection; }
          set { statusCollection = value; }
      }
  }
  </code></pre>
  
  <p>Now my problem is the subscribed event <code>SetStatus</code> is never called when the button is clicked in the first view model.</p>
  
  <p>What am i missing? Should my <code>ObservableCollection</code> implement <code>INotifyPropertyChanged</code> and on the setter of property I should publish my event?</p>