title: WPF Style DataTrigger with binding to DataContext not working
body: <p>I have a TextBox with a style that has a DataTrigger which changes the text, like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;Grid&gt;
      &lt;TextBlock Text="Foo"&gt;
          &lt;TextBlock.Style&gt;
              &lt;Style BasedOn="{StaticResource TextStyle}" TargetType="TextBlock"&gt;
                  &lt;Style.Triggers&gt;
                      &lt;DataTrigger Binding="{Binding MyBool}" Value="True"&gt;
                          &lt;Setter Property="Text" Value="Bar"/&gt;
                      &lt;/DataTrigger&gt;
                   &lt;/Style.Triggers&gt;
               &lt;/Style&gt;
           &lt;/TextBlock.Style&gt;
       &lt;/TextBlock&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>But it's not working, the text never changes to "Bar". I have tested using another TextBlock with Text="{Binding MyBool}" and this text changes from "False" to "True". Snoop reveals no errors that I can see and there is nothing in the output.</p>
  
  <p>This question may seem like a duplicate of <a href="https://stackoverflow.com/questions/1795476/wpf-trigger-binding-to-mvvm-property">WPF Trigger binding to MVVM property</a>, but my code does not seem different from the accepted answer there (<a href="http://www.thejoyofcode.com/Help_Why_cant_I_use_DataTriggers_with_controls_in_WPF.aspx" rel="noreferrer">http://www.thejoyofcode.com/Help_Why_cant_I_use_DataTriggers_with_controls_in_WPF.aspx</a>, section "Using a style") in any relevant way. And using a DataTemplate as suggested in the actual answer seems wrong since I only want this to apply to a single TextBlock, but if it is correct, I'm not sure how to write a DataTemplate for this...</p>
  
  <p>EDIT:</p>
  
  <p>This is what the property I'm binding to looks like:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public bool MyBool
  {
      get { return _myBool; }
      set
      {
          if (_myBool== value)
              return;
  
          _myBool= value;
          NotifyPropertyChanged();
      }
  }
  private bool _myBool;
  </code></pre>