title: C# WPF Background style for all Windows in ResourceDictionary - Target type with relative path?
body: <p>I'm organizing my projects with folders. So I have put all window files inside "MyWindows" folder, and in another folder called "Styles" I have a ResourceDictionary. Now I want to write a style for background that would apply to all desired windows, like this:</p>
  
  <pre><code>&lt;Style TargetType="Window" x:Key="Ozadje"&gt;
          &lt;Setter Property="Background"&gt;
              &lt;Setter.Value&gt;
                  &lt;LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0"&gt;
                      &lt;GradientStop Color="#FF66A7B6" Offset="0.997"/&gt;
                      &lt;GradientStop Color="White"/&gt;
                      &lt;GradientStop Color="#FFAEF1F1"/&gt;
                      &lt;GradientStop Color="#FFACEAEA"/&gt;
                      &lt;GradientStop Color="#FF9BF1E6"/&gt;
                      &lt;GradientStop Color="#FFBFD1CF" Offset="0.06"/&gt;
                      &lt;GradientStop Color="#FF6CAAB7" Offset="0.924"/&gt;
                      &lt;GradientStop Color="#FF99BFC4"/&gt;
                  &lt;/LinearGradientBrush&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  
      &lt;Style TargetType="MyWindows/Window1" BasedOn="{StaticResource {x:Type Window}}" /&gt;
  </code></pre>
  
  <p>I can't set this because all Windows are not in a <code>local:</code> namespace that resource dictionary is. And another problem is that styles for windows must be applied manually for each Window via reference.</p>
  
  <p>Is there anything I can do - besides calling <strong>Style="{StaticResource Ozadje}"</strong> in Window properties?...I'm curious if I can use a relative path.</p>
  
  <p>P.S.: I'm a beginner in WPF.</p>