title: Two views referring same viewmodel's property and command but records displayed only on first view not on 2nd view
body: <hr>
  
  <h2>Heading</h2>
  
  <p>Below are my views. First one is main view and 2nd one is another view 
  which is using the same view model and data. it gets the data from excel and store in grid. The issue is, on first main view , values on data grid are displayed correctly ,but when i click on button available on first view,which opens 2nd view, doesnt display the records but showing blank. i want to display the same records on view 2 .</p>
  
  <p>enter code here Main View:-</p>
  
  <pre><code>&lt;Window x:Class="Main.View.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:PrestoControls="clr-namespace:PrestoControls;assembly=PrestoControls"
          xmlns:local="clr-namespace:Main.ViewModel"
          xmlns:localControls="clr-namespace:Main.View"
          x:Name="Window"
          Title="{Binding Scenario}"
          Width="1400"
          Height="800"
          WindowStartupLocation="CenterScreen"
          WindowState="Maximized"&gt;
  
      &lt;Grid&gt;
  
          &lt;DataGrid x:Name="datagrid_sku_part_details"
              Grid.Row="0"
              Margin="10,5,0,5"
              ItemsSource="{Binding SKUPartDetailsSubset,
                                  Mode=TwoWay,
                                  UpdateSourceTrigger=PropertyChanged}"
              SelectedItem="{Binding SelectedSku,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
              SelectionUnit="FullRow"
              Style="{StaticResource style_main_datagrid}"&gt;
  
              &lt;DataGrid.Columns&gt;
                  &lt;DataGridTextColumn x:Name="col_sku_part_details_class"
                      Width="60"
                      Binding="{Binding Class}"
                      Header="{Binding RelativeSource={RelativeSource Self},
                                          Converter={StaticResource string_converter},
                                          ConverterParameter='col_sku_part_details_class'}"
                      IsReadOnly="true" /&gt;
                  &lt;DataGridTextColumn x:Name="col_sku_part_details_range"
                      Width="100"
                      Binding="{Binding Range}"
                      Header="{Binding RelativeSource={RelativeSource Self},
                                          Converter={StaticResource string_converter},
                                          ConverterParameter='col_sku_part_details_range'}"
                      IsReadOnly="true" /&gt;
                  &lt;DataGrid.Columns&gt;
  
          &lt;/DataGrid&gt;
          &lt;Button x:Name="btn_run_Demand_multipliers_in_budget_years1"
                           Margin="10,10,-9,10"
                           DockPanel.Dock="Bottom"
                           Style="{StaticResource style_btn_run_ranges}"
                           Content="Demand multipliers in budget years"  
                           Command="{Binding DemandMultiplierInBudgetYear, Mode=TwoWay}" &gt;
          &lt;/Button&gt;
          &lt;Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>2nd View</p>
  
  <pre><code>    &lt;Window x:Class="Main.View.MultiplierForBudgetReport"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="MultiplierForBudgetReport" Height="500" Width="900"
          xmlns:PrestoControls="clr-namespace:PrestoControls;assembly=PrestoControls"
          xmlns:local="clr-namespace:Main.ViewModel"
          xmlns:localControls="clr-namespace:Main.View"
          xmlns:sync="clr-namespace:Main.ViewModel.Synchronisation"
          x:Name="Window"
  
          &gt;
  
                  &lt;Grid&gt;
                      &lt;Grid x:Name="grid_sku_part_details"&gt;
                          &lt;Grid.ColumnDefinitions&gt;
                              &lt;ColumnDefinition Width="16*"/&gt;
                              &lt;ColumnDefinition Width="489*"/&gt;
                          &lt;/Grid.ColumnDefinitions&gt;
  
                          &lt;Grid.RowDefinitions&gt;
                              &lt;RowDefinition Height="*" /&gt;
                              &lt;RowDefinition Height="50" /&gt;
                          &lt;/Grid.RowDefinitions&gt;
  
                          &lt;DataGrid x:Name="datagrid_sku_part_details"
                                  Grid.Row="0"
                                  Margin="10,5,0,5"
                                  ItemsSource="{Binding SKUPartDetailsSubset,
                                                      Mode=TwoWay,
                                                      UpdateSourceTrigger=PropertyChanged}"
                                  SelectedItem="{Binding SelectedSku,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
  
                                  SelectionUnit="FullRow"
                                  Style="{StaticResource style_main_datagrid}" Grid.ColumnSpan="2" SelectionChanged="datagrid_sku_part_details_SelectionChanged"&gt;
  
                              &lt;DataGrid.Columns&gt;
                                  &lt;DataGridTextColumn x:Name="col_sku_part_details_class"
                                      Width="60"
                                      Binding="{Binding Class}"
                                      Header="{Binding RelativeSource={RelativeSource Self},
                                                          Converter={StaticResource string_converter},
                                                          ConverterParameter='col_sku_part_details_class'}"
                                      IsReadOnly="true" /&gt;
                                  &lt;DataGridTextColumn x:Name="col_sku_part_details_range"
                                      Width="100"
                                      Binding="{Binding Range}"
                                      Header="{Binding RelativeSource={RelativeSource Self},
                                                          Converter={StaticResource string_converter},
                                                          ConverterParameter='col_sku_part_details_range'}"
                                      IsReadOnly="true" /&gt;
                                  &lt;DataGridTextColumn x:Name="col_sku_part_details_sku_reference"
                                      Width="150"
                                      Binding="{Binding SKUReference}"
                                      Header="{Binding RelativeSource={RelativeSource Self},
                                                          Converter={StaticResource string_converter},
                                                          ConverterParameter='col_sku_part_details_sku_reference'}"
                                      IsReadOnly="true" /&gt;
                                  &lt;DataGridTextColumn x:Name="col_sku_part_details_part_reference"
                                      Width="150"
                                      Binding="{Binding PartReference}"
                                      Header="{Binding RelativeSource={RelativeSource Self},
                                                          Converter={StaticResource string_converter},
                                                          ConverterParameter='col_sku_part_details_part_reference'}"
                                      IsReadOnly="true" /&gt;
                                  &lt;DataGridTextColumn x:Name="col_sku_part_details_part_name"
                                      Width="250"
                                      Binding="{Binding PartName}"
                                      Header="{Binding RelativeSource={RelativeSource Self},
                                                          Converter={StaticResource string_converter},
                                                          ConverterParameter='col_sku_part_details_part_name'}"
                                      IsReadOnly="true" /&gt;
                              &lt;/DataGrid.Columns&gt;
                          &lt;/DataGrid&gt;
  
                      &lt;/Grid&gt;
                  &lt;/Grid&gt; enter code here
              &lt;/Window&gt;
  </code></pre>
  
  <p>below is the command used for button:-</p>
  
  <pre><code>public class DemandMultiplierBudYearCommand : ICommand
  {
  
      #region Fields
  
      private MainWindowViewModel m_ViewModel;
  
      #endregion
  
      #region Constructor
  
      public DemandMultiplierBudYearCommand(MainWindowViewModel viewModel)
      {
          m_ViewModel = viewModel;
      }
  
      #endregion
  
      #region ICommand Members
  
      /// &lt;summary&gt;
      /// Whether the command is enabled.
      /// &lt;/summary&gt;
      public bool CanExecute(object parameter)
      {
          return true;
      }
  
      /// &lt;summary&gt;
      /// Actions to take when CanExecute() changes.
      /// &lt;/summary&gt;
      public event EventHandler CanExecuteChanged
      {
          add { CommandManager.RequerySuggested += value; }
          remove { CommandManager.RequerySuggested -= value; }
      }
  
      /// &lt;summary&gt;
      /// Executes the command
      /// &lt;/summary&gt;
      public void Execute(object parameter)
      {
  
          View.MultiplierForBudgetReport Mfbg = new View.MultiplierForBudgetReport();
          Mfbg.DataContext = m_ViewModel;
          Mfbg.ShowDialog();
      }
  
      #endregion
  }
  </code></pre>