title: How can I display my user control in the MainWindow?
body: <p>I'm trying to build a small MVVM test application, but can't really figure how to display my user control in the MainWindow.</p>
  
  <p>My Solution Explorer:</p>
  
  <p><img src="https://i.stack.imgur.com/epR3y.png" alt="How my solution looks like"></p>
  
  <p>I got a resource dictionary:</p>
  
  <pre><code>    &lt;ResourceDictionary
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:vm="clr-namespace:MVVM.ViewModel"
      xmlns:vw="clr-namespace:MVVM.View"&gt;
  
      &lt;DataTemplate DataType="{x:Type vm:ViewModel}"&gt;
          &lt;vw:View /&gt;
      &lt;/DataTemplate&gt;
  
  &lt;/ResourceDictionary&gt;
  </code></pre>
  
  <p>I got my view:</p>
  
  <pre><code>&lt;UserControl x:Class="MVVM.View.View"
               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" 
               mc:Ignorable="d" 
               d:DesignHeight="300" d:DesignWidth="300"&gt;
      &lt;UserControl.Resources&gt;
          &lt;DataTemplate x:Key="PersonTemplate"&gt;
              &lt;StackPanel&gt;
                  &lt;TextBlock Text="{Binding FirstName}" /&gt;
              &lt;/StackPanel&gt;
          &lt;/DataTemplate&gt;
      &lt;/UserControl.Resources&gt;
  
      &lt;ListBox ItemsSource="{Binding Path=Persons}"
               ItemTemplate="{StaticResource PersonTemplate}" /&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>and My MainWindow</p>
  
  <pre><code>&lt;Window x:Class="MVVM.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:vm="clr-namespace:MVVM.ViewModel"
          Title="MainWindow" Height="350" Width="525"&gt;
      &lt;Window.Resources&gt;
          &lt;ResourceDictionary Source="MainWindowResources.xaml" /&gt;
      &lt;/Window.Resources&gt;
  
      &lt;Grid&gt;
  
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>