Browse Source

RichtextBoxFormatBar: fixed bug where text would loose highlight after first text transformation was applied.

pull/1645/head
brianlagunas_cp 15 years ago
parent
commit
7f5a1b75f5
  1. 9
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/RichTextBoxFormatBar/RichTextBoxFormatBarManager.cs

9
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/RichTextBoxFormatBar/RichTextBoxFormatBarManager.cs

@ -75,6 +75,14 @@ namespace Microsoft.Windows.Controls
HideAdorner();
}
void RichTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
//this fixes the bug when applying text transformations the text would lose it's highlight. That was because the RichTextBox was losing focus
//so we just give it focus again and it seems to do the trick of re-highlighting it.
if (!_richTextBox.IsFocused)
_richTextBox.Focus();
}
#endregion //Event Handlers
#region Methods
@ -89,6 +97,7 @@ namespace Microsoft.Windows.Controls
_richTextBox = richTextBox;
_richTextBox.PreviewMouseMove += RichTextBox_PreviewMouseMove;
_richTextBox.PreviewMouseLeftButtonUp += RichTextBox_PreviewMouseLeftButtonUp;
_richTextBox.TextChanged += RichTextBox_TextChanged;
_adorner = new UIElementAdorner<Control>(_richTextBox);

Loading…
Cancel
Save