title: Prism 6: Multiple Views get data from one ViewModel
body: <p>so im working now a week with Prism and it´s great :) my question is now: Can i get the Data from one ViewModel to multiple Views (in most cases 2 Views). I work with the ViewModelLocator like Brian Lagunas in this Webinar -> <a href="https://www.youtube.com/watch?v=ZfBy2nfykqY" rel="nofollow">https://www.youtube.com/watch?v=ZfBy2nfykqY</a></p>
  
  <p>The Example from Webinar: I have Views named ViewA + ViewB and ViewModels named ViewAViewModel + ViewBViewModel. Now i want that the Locator take ViewAViewModel for both ViewA and ViewB. </p>
  
  <p>Code ViewA:</p>
  
  <pre><code>&lt;UserControl x:Class="MVVM_Prism_Mein_einfaches_Beispiel.Views.ViewA"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
               xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
               xmlns:local="clr-namespace:MVVM_Prism_Mein_einfaches_Beispiel.Views"
               xmlns:prism="http://prismlibrary.com/"
               prism:ViewModelLocator.AutoWireViewModel="True"
               mc:Ignorable="d" 
               d:DesignHeight="300" d:DesignWidth="300"&gt;
      &lt;Grid&gt;
          &lt;Label x:Name="lbl_Firstname" Content="Firstname:" HorizontalAlignment="Left" Margin="61,38,0,0" VerticalAlignment="Top"/&gt;
          &lt;TextBox x:Name="tb_Firstname" HorizontalAlignment="Left" Height="23" Margin="129,38,0,0" TextWrapping="Wrap" Text="{Binding FirstName, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Width="120"/&gt;
          &lt;Label x:Name="lbl_Lastname" Content="Lastname:" HorizontalAlignment="Left" Margin="61,70,0,0" VerticalAlignment="Top"/&gt;
          &lt;TextBox x:Name="tb_Lastname" HorizontalAlignment="Left" Height="23" Margin="129,70,0,0" TextWrapping="Wrap" Text="{Binding LastName, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Width="120"/&gt;
          &lt;Label x:Name="lbl_Updated" Content="Updated:" HorizontalAlignment="Left" Margin="61,102,0,0" VerticalAlignment="Top"/&gt;
          &lt;TextBlock x:Name="txb_Update" HorizontalAlignment="Left" Margin="129,107,0,0" TextWrapping="Wrap" Text="{Binding LastUpdated}" VerticalAlignment="Top"/&gt;
          &lt;Button x:Name="btn_Update" Content="Update" HorizontalAlignment="Left" Margin="129,141,0,0" VerticalAlignment="Top" Width="75" Command="{Binding UpdateCommand}"/&gt;
          &lt;Button x:Name="btn_Upview" Content="Update + View" HorizontalAlignment="Left" Margin="129,171,0,0" VerticalAlignment="Top" Width="75" Command="{Binding NavigateCommand}" CommandParameter="ViewTablet"/&gt;
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>ViewAViewModel:</p>
  
  <pre><code>using MVVM_Prism_Mein_einfaches_Beispiel.Events;
  using Prism.Commands;
  using Prism.Events;
  using Prism.Mvvm;
  using Prism.Regions;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Input;
  
  namespace MVVM_Prism_Mein_einfaches_Beispiel.ViewModels
  {
      public class ViewAViewModel : BindableBase
      {
          private string _firstName = "Brian";
          public string FirstName
          {
              get { return _firstName; }
              set { SetProperty(ref _firstName, value); }
          }
  
          private string _lastName;
          public string LastName
          {
              get { return _lastName; }
              set { SetProperty(ref _lastName, value); }
          }
  
          private DateTime? _testupdate;
          public DateTime? TestUpdate
          {
              get { return _testupdate; }
              set { SetProperty(ref _testupdate, value); }
          }
  
          public ICommand UpdateCommand { get; set; }
          private IEventAggregator _eventAggregator;
  
          public ViewAViewModel(IEventAggregator eventAggregator, IRegionManager regionManager)
          {
              _eventAggregator = eventAggregator;
              UpdateCommand = new DelegateCommand(Execute, CanExecute).ObservesProperty(() =&gt; FirstName).ObservesProperty(() =&gt; LastName);
  
              _regionManager = regionManager;
              NavigateCommand = new DelegateCommand&lt;string&gt;(Navigate);
          }
  
          private IRegionManager _regionManager;
  
          public DelegateCommand&lt;string&gt; NavigateCommand { get; set; }
  
          private void Navigate(string view)
          {
              _regionManager.RequestNavigate("ContentRegion", view);
          }
  
          private bool CanExecute()
          {
              return !String.IsNullOrWhiteSpace(FirstName) &amp;&amp; !String.IsNullOrWhiteSpace(LastName);
          }
  
          private void Execute()
          {
              LastUpdated = DateTime.Now; 
              _eventAggregator.GetEvent&lt;UpdateEvent&gt;().Publish(LastUpdated.ToString());
          }
      }
  }
  </code></pre>
  
  <p>ViewB should be like ViewA.</p>
  
  <p>Thx for your help. 
  Best Regards Shazzar </p>