title: Can't put a window in a style (WPF)
body: <p>I have the feeling that I am missing something very important. I've created the following code:</p>
  
  <p>File: App.xaml</p>
  
  <pre><code>&lt;Application x:Class="HelloWorld.App"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               Startup="Application_Startup"&gt;
      &lt;Application.Resources&gt;
  
          &lt;ResourceDictionary&gt;
              &lt;ResourceDictionary.MergedDictionaries&gt;
                  &lt;ResourceDictionary Source="MainView.xaml" /&gt;
              &lt;/ResourceDictionary.MergedDictionaries&gt;
          &lt;/ResourceDictionary&gt;
  
      &lt;/Application.Resources&gt;
  &lt;/Application&gt;
  </code></pre>
  
  <p>File: MainWindow.xaml</p>
  
  <pre><code>&lt;ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:viewmodel="clr-namespace:HelloWorld.ViewModel"&gt;
      &lt;DataTemplate DataType="{x:Type viewmodel:ViewModel}"&gt;
          &lt;Window Title="HelloWorld"&gt;
              &lt;Window.Resources&gt;
                  &lt;Style TargetType="TextBlock"&gt;
                      &lt;Setter Property="Margin" Value="50"&gt;&lt;/Setter&gt;
                  &lt;/Style&gt;
              &lt;/Window.Resources&gt;
              &lt;TextBlock Text="TODO" /&gt;
          &lt;/Window&gt;
      &lt;/DataTemplate&gt;
  &lt;/ResourceDictionary&gt;
  </code></pre>
  
  <p>Although I can compile the code and everything looks good. I get the grey wiggly lines from <code>&lt;Window Title="HelloWorld"&gt;</code> to <code>&lt;/Window&gt;</code> with the message "Can't put a Window in a Style.". I am wondering what did I do wrong?</p>
  
  <p>What should I do to improve my code? I am btw trying to use the MVVM.</p>
  
  <p>Thanks!</p>