title: Setting same style twice to different instances in code
body: <p>I am trying to reuse shape data to dynamically create new shapes in code. Basically I want to do this <a href="https://stackoverflow.com/questions/839843/reuse-path-object-in-xaml">Reuse path object in XAML</a> but in code. Here is the situation:</p>
  
  <pre><code>        Path path = new Path();
          path.Style = (System.Windows.Style)this.Resources["PathStyle"];
          Path path2 = new Path();
          path2.Style = (System.Windows.Style)this.Resources["PathStyle"];
  </code></pre>
  
  <p>But i get an <strong>ArgumentException</strong> on the fourth line saying "<em>Value does not fall within the expected range"</em></p>
  
  <p>The code is in the MainControl of a SL 3 application.
  The XAML code for the resource is </p>
  
  <pre><code> &lt;UserControl.Resources&gt;
          &lt;Style x:Key="PathStyle" TargetType="Path"&gt;
              &lt;Setter Property="Data" Value="M63,171 L138,117 L168,189 L99,219"/&gt;
              &lt;Setter Property="Fill" Value="#FFF07E7E"/&gt;
              &lt;Setter Property="Height" Value="103"/&gt;
              &lt;Setter Property="Width" Value="106"/&gt;
              &lt;Setter Property="Stroke" Value="#FF000000"/&gt;
              &lt;Setter Property="Stretch" Value="Fill"/&gt;
          &lt;/Style&gt;
  &lt;/UserControl.Resources&gt;
  </code></pre>
  
  <p>Any ideas?</p>