title: Binding the Key in <object property="{StaticResource key}" .../> to a value
body: <p>In WPF, is it possible to bind the key in "{StaticResource key}"to a variable.</p>
  
  <p>For example. I have a variable <strong>ExecutionState</strong> with the states <strong>Active</strong> and <strong>Completed</strong>.</p>
  
  <p>In my ResourceDictionary I have</p>
  
  <pre><code>&lt;Style TargetType="{x:Type TextBlock}" x:Key="Active"&gt;
          &lt;Setter Property="Foreground" Value="Yellow"/&gt;
      &lt;/Style&gt;
      &lt;Style TargetType="{x:Type TextBlock}" x:Key="Completed"&gt;
          &lt;Setter Property="Foreground" Value="Green"/&gt;
      &lt;/Style&gt;
  </code></pre>
  
  <p>Instead of having </p>
  
  <pre><code>&lt;TextBlock Style="{StaticResource Active}"/&gt;
  </code></pre>
  
  <p>I Would like to have something like</p>
  
  <pre><code>&lt;TextBlock Style="{StaticResource {Binding ExecutionState}}"/&gt;
  </code></pre>
  
  <p>Thus if the state changes the text color changes. 
  Is something like this even possible?
  I can achieve the wanted functionality using triggers, but I have to reuse it at several places and I don't want to clutter my code.
  I am using MVVM also.</p>
  
  <p>thanx</p>