title: Binding in WPF DataTrigger value
body: <p>Well, this may be an easy question but I am not able to find a solution for this. </p>
  
  <p>I have a <code>DataTrigger</code> as</p>
  
  <pre><code>&lt;DataTrigger Binding="{Binding Quantity}" Value="0"&gt;
  </code></pre>
  
  <p>Now I want to bind <code>Value</code> to a variable <code>myVariable</code>. So if the value of <code>myVariable</code> changes, the <code>Value</code> property of the DataTrigger changes too.</p>
  
  <p>I have tried setting Binding but it I guess its not possible to set it. Is there any other method by which I can set this Value dynamically. </p>
  
  <p>EDIT : I tried creating a data trigger of my own. But I am still not able to get things working.</p>
  
  <p>This is the code :</p>
  
  <pre><code>DataTrigger d = new DataTrigger();
  d.Binding = new Binding("Quantity");
  d.Value = 1;
  Setter s = new Setter(BackgroundProperty, Brushes.Red);
  d.Setters.Add(s);
  
  Style st = new Style(typeof(DataGridRow));
  st.Triggers.Add(d);
  this.Resources.Add(this.Resources.Count, st);
  </code></pre>
  
  <p>I want to use the above code in place of following xaml</p>
  
  <pre><code>&lt;Page.Resources&gt;
      &lt;Style TargetType="DataGridRow"&gt;
          &lt;Style.Triggers&gt;
              &lt;DataTrigger Binding="{Binding Quantity}" Value="1"&gt;
                  &lt;Setter Property="Background" Value="Red" /&gt;
              &lt;/DataTrigger&gt;
          &lt;/Style.Triggers&gt;
      &lt;/Style&gt;
  &lt;/Page.Resources&gt;
  </code></pre>
  
  <p>Thanks.</p>