title: Control bound to property value doesn't update
body: <p>I'm having a bit of a problem with WPF property binding. First the code.</p>
  
  <p>C#</p>
  
  <pre><code>public partial class WPFTextBox: UserControl
  {
      private bool _bold;
      public bool Bold
      {
          get { return _bold; }
          set
          {
              _bold = value;
              OnPropertyChanged("Bold");
          }
      }
  
      private bool _selectionChanged;
  
      public WPFTextBox()
      {
          InitializeComponent();
  
          DataContext = this;
  
          Bold = true;  // &lt;--- This works, the checkbox will be checked
          _selectionChanged = false;
       }
  
       private void txtDetails_SelectionChanged(object sender, RoutedEventArgs e)
       {
           var selection = txtDetails.Selection;
           _selectionChanged = true;
           Bold = selection.FontWeight() == FontWeights.Bold; 
           // ^-- This doesn't work It will trigger everything, but the checkbox won't
           // change value. FontWeight() is an extension I wrote
           _selectionChanged = false;
       }
  
       private void OnPropertyChanged(string name)
       {
           if(_selectionChanged)
              return; // If the change was brought from the user moving the
                      // cursor in the textbox, don't change the textbox.
           TextRange range = txtDetails.Selection;
           switch(name)
           {
               case "Bold":
                   // change selection to bold, like I mentioned I does work
                   break;
               default:
                   break;
           }
       }
  }
  </code></pre>
  
  <p>XAML</p>
  
  <pre><code>&lt;RichTextBox Name="txtDetails" SelectionChanged="txtDetails_SelectionChanged"/&gt;
  
  &lt;CheckBox Name="chkBold" Content="Bold" IsChecked="{Binding Path=Bold}"/&gt;
  </code></pre>
  
  <p>I'm creating a textbox with format options. The binding works in the constructor, but not in the selection changed event. I've tried adding a lot of options to the binding such as <code>Mode=TwoWay</code> and different property changed triggers.</p>
  
  <p>The reason I'm using the <code>_selectionChanged</code> bool is because if I don't check for that, if I have a word was different formatting such as he<strong>llo</strong> and I click on it, it will change the formatting for all of the word to either bold or not. I think maybe it's because I'm handling it in selection changed event, but then I'm not sure where else I could change property value.</p>