WPF DataGrid binding to an Entity Framework with help of mvvm light
<p>I'm having trouble to be able to bind <code>DeviceListDataGrid</code>  to an entity (EF7). The datagrid is not showing any of the data contained by the source. I'm using mvvm-light toolkit.</p>

<p>Here's the xaml </p>

<pre><code>&lt;Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:viewModel="clr-namespace:FxEditorDatabaseStructure.ViewModel"
    xmlns:domain="clr-namespace:FxEditorDatabaseStructure.Core.Domain"
    x:Class="FxEditorDatabaseStructure.Views.DeviceDatabaseView"
    DataContext="{Binding Source={StaticResource Locator}, Path=DeviceDatabaseViewModel}"
    Title="MainWindow" Height="800" Width="500"&gt;
    &lt;i:Interaction.Triggers&gt;
        &lt;i:EventTrigger EventName="Loaded"&gt;
            &lt;i:InvokeCommandAction Command="{Binding WindowLoadedCommand}" /&gt;
        &lt;/i:EventTrigger&gt;
    &lt;/i:Interaction.Triggers&gt;
    &lt;Grid DataContext="{Binding Source={StaticResource Locator}}"&gt;
        &lt;Grid.RowDefinitions&gt;
            &lt;RowDefinition Height="2*" /&gt;
            &lt;RowDefinition Height="2*" /&gt;
        &lt;/Grid.RowDefinitions&gt;
        &lt;Grid.ColumnDefinitions&gt;
            &lt;ColumnDefinition Width="*" /&gt;
            &lt;ColumnDefinition Width="*" /&gt;
        &lt;/Grid.ColumnDefinitions&gt;
        &lt;TabControl Grid.Column="0" 
                    Grid.Row="1" 
                    x:Name="TabPanel" 
                    HorizontalAlignment="Left" 
                    Margin="0,20,0,0" 
                    Grid.ColumnSpan="2" 
                    Width="492"&gt;
            &lt;TabItem Header="Basic"&gt;
                &lt;Grid&gt;
                    &lt;TextBox x:Name="ProductCode" HorizontalAlignment="Left" Height="21.96" Margin="10,20,0,0" TextWrapping="Wrap" Text="{Binding DeviceDatabaseViewModel.DeviceList/Name}" VerticalAlignment="Top" Width="90" /&gt;
                    &lt;TextBox x:Name="Description" HorizontalAlignment="Left" Height="21.96" Margin="10,70,0,0" TextWrapping="Wrap" Text="{Binding DeviceDatabaseViewModel.DeviceList.Count, Mode=OneWay}" VerticalAlignment="Top" Width="90" /&gt;
                    &lt;TextBox x:Name="Notes" Height="71.96" Margin="121.5,20,125,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top"/&gt;
                &lt;/Grid&gt;
            &lt;/TabItem&gt;
            &lt;TabItem Header="Advanced"&gt;&lt;/TabItem&gt;
            &lt;TabItem Header="Technical data"&gt;&lt;/TabItem&gt;
        &lt;/TabControl&gt;
        &lt;Menu Grid.Column="0" Grid.Row="0" x:Name="menuPanel" HorizontalAlignment="Left" Margin="0,0,0,0" Grid.ColumnSpan="2" Width="492"&gt;
            &lt;MenuItem Header="Add device"&gt;&lt;/MenuItem&gt;
            &lt;MenuItem Header="Import database"&gt;&lt;/MenuItem&gt;
            &lt;MenuItem Header="Export database"&gt;&lt;/MenuItem&gt;
        &lt;/Menu&gt;
        &lt;TextBlock x:Name="ProductSpecifications" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="0"
                   TextWrapping="Wrap" Text="Product specifications" VerticalAlignment="Top" FontSize="9.333"/&gt;
        &lt;DataGrid 
                  x:Name="DeviceListDataGrid" 
                  Margin="0,25,0,0"
                  Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
                  AutoGenerateColumns="False" 
                  EnableRowVirtualization="True" 
                  AlternatingRowBackground="LightBlue" 
                  AlternationCount="2" 
                  RowDetailsVisibilityMode="VisibleWhenSelected"
                  ItemsSource="{Binding Source={StaticResource Locator}, Path=DeviceDatabaseViewModel}"&gt;
            &lt;DataGrid.Columns&gt;
                &lt;DataGridTextColumn x:Name="NameColumn" Header="Name" Width="200*" Binding="{Binding DeviceList/Name}"  /&gt;
                &lt;DataGridTextColumn x:Name="DescriptionColumn" Header="Description" Width="200*" Binding="{Binding DeviceList/Description}"/&gt;
                &lt;DataGridTextColumn x:Name="ProductTypeColumn" Header="Supplier" Width="150*" Binding="{Binding DeviceList/Supplier}"/&gt;
            &lt;/DataGrid.Columns&gt;
        &lt;/DataGrid&gt;
    &lt;/Grid&gt;
&lt;/Window&gt;
</code></pre>

<p>The text-boxes <code>ProductCode</code> and <code>Description</code> are working fine with similar binding approaches. Does the datagrid require some sort of special binding? I'am unable to see what is missing..</p>

<p>Earlier I asked question similar to this one, but now I would like to use mvvm light's <em>locator</em> approach for the data binding. Here is the earlier question with working solution. <a href="https://stackoverflow.com/questions/35164404/binding-entity-into-wpf-datagrid-with-ef-7-core">Binding entity into WPF datagrid with EF 7 (core)</a> and the source for that questions code.
<a href="https://msdn.microsoft.com/en-us/data/jj574514.aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/data/jj574514.aspx</a></p>

<p>As a background information here's the <strong>WindowLoadedMethod</strong>:</p>

<pre><code>private void WindowLoadedMethod()
{
    _context.Devices.Load();
    _devices = _context.Devices.GetLocal();
    RaisePropertyChanged(() =&gt; DeviceList);
}
</code></pre>

<p>I have implemented the <code>GetLocal</code> method mentioned <a href="https://stackoverflow.com/questions/33819159/is-there-a-dbsettentity-local-equivalent-in-entity-framework-7">here</a>. I assume it's not interfering the binding. </p>

<p>and <strong>DeviceList</strong> method:</p>

<pre><code>public ObservableCollection&lt;Device&gt; DeviceList
{
    get
    {
        return _devices;
    }
}
</code></pre>

<p>and beginning of the <strong>viewmodel</strong> </p>

<pre><code>public class DeviceDatabaseViewModel : ViewModelBase
{
    private IUnitOfWork _context = ServiceLocator.Current.GetInstance&lt;IUnitOfWork&gt;();
    private ObservableCollection&lt;Device&gt; _devices;
    public DeviceDatabaseViewModel()
    {
        WindowLoadedCommand = new RelayCommand(WindowLoadedMethod);
    }

    public RelayCommand WindowLoadedCommand { private set; get; }
</code></pre>

<p>and here the <strong>App.xaml</strong></p>

<pre><code>&lt;Application x:Class="FxEditorDatabaseStructure.App" 
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             xmlns:local="clr-namespace:FxEditorDatabaseStructure" 
             StartupUri="Views/MainWindow.xaml" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             d1p1:Ignorable="d"
             xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:viewModel="clr-namespace:FxEditorDatabaseStructure.ViewModel"&gt;
  &lt;Application.Resources&gt;
    &lt;ResourceDictionary&gt;
            &lt;viewModel:ViewModelLocator x:Key="Locator" d:IsDataSource="True" xmlns:vm="clr-namespace:FxEditorDatabaseStructure.ViewModel" /&gt;
    &lt;/ResourceDictionary&gt;
  &lt;/Application.Resources&gt;
&lt;/Application&gt;
</code></pre>