title: Enable data binding in shared WPF resources inside a ResourceDictionary
body: <p>I'm using the M-V-VM pattern in WPF and I have a background brush I'm going to be using rather often and I'd like to move it out in to a shared ResourceDictionary.</p>
  
  <p>The only problem is the brush uses a color which it gets via Databinding to its hosted context.</p>
  
  <p>Is there anyway I can move the brush out in to a ResourceDictionary and still have it find the value it needs?</p>
  
  <p>The Brush:</p>
  
  <pre><code>&lt;RadialGradientBrush&gt;
      &lt;RadialGradientBrush.RelativeTransform&gt;
          &lt;TransformGroup&gt;
              &lt;ScaleTransform CenterX="0.5"
                              CenterY="0.5"
                              ScaleX="2.3"
                              ScaleY="2.3" /&gt;
              &lt;TranslateTransform X="-0.3"
                                  Y="-0.3" /&gt;
          &lt;/TransformGroup&gt;
      &lt;/RadialGradientBrush.RelativeTransform&gt;
      &lt;GradientStop Color="{Binding Path=BackdropColor}"
                    Offset="1.2" /&gt;
      &lt;GradientStop Color="#FFFFFFFF"
                    Offset="-0.1" /&gt;
  &lt;/RadialGradientBrush&gt;
  </code></pre>
  
  <p>After re-factoring it out to a ResourceDictionary and adding a key, I called it as such:</p>
  
  <pre><code>&lt;StackPanel Grid.Row="0"
              Margin="0,0,0,0"
              Orientation="Horizontal"
              Background="{DynamicResource BackdropRadGradBrush}"&gt;
  </code></pre>
  
  <p>But this resulted in this output in the debugger:</p>
  
  <p><em>System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=BackdropColor; DataItem=null; target element is 'GradientStop' (HashCode=16001149); target property is 'Color' (type 'Color')</em></p>