title: WPF Datagrid Master Detail MVVM
body: <p>I have an WPF application. I have two datagrids, one contains a list of indicators and another datagrid that I want to show further details of the selected indicator of the top datagrid.</p>
  
  <p>However my detail grid does not show any data and I can't work out why. I should point out that the master datagrid is populating fine. I have put a break in the setter of the property IndicatorSelected and can see it is being called when an item is selected &amp; the see the data is correct but is just not being displayed in the detail datagrid.</p>
  
  <p>XAML</p>
  
  <pre><code>&lt;DataGrid x:Name="dgModels" Grid.Column="0" 
                        ItemsSource="{Binding Path=IndicatorList}"
                        SelectedItem="{Binding Path=IndicatorSelected}"
                        AutoGenerateColumns="false"&gt;
      &lt;DataGrid.Columns&gt;
          &lt;DataGridTextColumn Header="Model" Binding="{Binding Name}" IsReadOnly="True"/&gt;
          &lt;DataGridCheckBoxColumn Header="Run" Binding="{Binding Run}" IsReadOnly="false"/&gt;
      &lt;/DataGrid.Columns&gt;                                            
  &lt;/DataGrid&gt;
  
  &lt;DataGrid x:Name="dgParameterInfo" Grid.Column="1"
            ItemsSource="{Binding Path=IndicatorSelected}"
            AutoGenerateColumns="false"&gt;
      &lt;DataGrid.Columns&gt;
          &lt;DataGridTextColumn Header="Parameter Name" Binding="{Binding Path=Name}" IsReadOnly="True"/&gt;
          &lt;DataGridTextColumn Header="Default Value" Binding="{Binding Path=DefaultValue}" IsReadOnly="True"/&gt;
          &lt;DataGridTextColumn Header="Run Value" Binding="{Binding Path=RunValue}" IsReadOnly="True"/&gt;
          &lt;DataGridTextColumn Header="Parameter Type" Binding="{Binding Path=ParaType}" IsReadOnly="True"/&gt;
      &lt;/DataGrid.Columns&gt;                    
  &lt;/DataGrid&gt;    
  </code></pre>
  
  <p>C#</p>
  
  <pre><code>class ViewModel : INotifyPropertyChanged
  {
      List&lt;IndicatorWrapper&gt; _indicatorList;
      IndicatorWrapper _indicatorWrapper; 
  
      public List&lt;IndicatorWrapper&gt; IndicatorList
      {
          get { return _indicatorList; }
          set 
          { 
              _indicatorList = value;
              OnPropertyChanged("IndicatorList");
          }
      }
      public IndicatorWrapper IndicatorSelected
      {
          get { return _indicatorWrapper; }
          set
          {
              _indicatorWrapper = value;
              OnPropertyChanged("IndicatorWrapper");
          }
      }
  
      public ViewModel()
      {
          DatabaseRetrieveSimulator db = new DatabaseRetrieveSimulator();
          IndicatorList = db.GetIndicators();
      }
  }
  </code></pre>