title: Rich text box keep selected highlighted when focus is lost
body: <p>I am creating a simple wysiwyg editor by using a <code>dockpanel</code> with some buttons for changing font size and such, and a <code>richtextbox</code> as the main area. I can highlight text and then use the buttons to change the size, and family of the font. However when I click in the "toolbar" the <code>RichTextBox</code> loses focus and the selected text is no longer highlighted. I have found several hacky solutions such as setting <code>e.handled =true;</code> on the lost focus event, this works but if the font size changes for example, the text is now larger than the highlight. Is there a better solution to this?</p>
  
  <p>Here is some stripped down code:</p>
  
  <pre><code>    &lt;DockPanel&gt;
          &lt;DockPanel &gt;
              &lt;ToggleButton Height="24" Margin="3" Name="Bold"&gt;
                  &lt;TextBlock FontWeight="ExtraBold" Text="B" /&gt;
              &lt;/ToggleButton&gt;
              &lt;ToggleButton Height="24" Margin="3" Name="Italic"&gt;
                  &lt;TextBlock FontStyle="Italic" Text="I" /&gt;
              &lt;/ToggleButton&gt;
              &lt;ToggleButton Height="24" Margin="3" Name="Underline"&gt;
                  &lt;TextBlock TextDecorations="Underline" Text="U" /&gt;
              &lt;/ToggleButton&gt;
              &lt;ComboBox Height="24" Margin="3" Name="FontFamily" Width="150" SelectionChanged="FontFamily_SelectionChanged"/&gt;
              &lt;ComboBox Height="24" Margin="3" Name="FontSize" Width="50" IsEditable="True" TextBoxBase.TextChanged="FontSize_TextChanged" /&gt;
          &lt;/DockPanel&gt;
      &lt;/DockPanel&gt;
      &lt;RichTextBox Name="Editor" /&gt;
  </code></pre>