Browse Source

RichTextBox: using dispatcher to set the text to improve perofrmance.

pull/1645/head
brianlagunas_cp 15 years ago
parent
commit
c9a7d7fb1d
  1. 11
      ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/RichTextBox/RichTextBox.cs

11
ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/RichTextBox/RichTextBox.cs

@ -1,6 +1,7 @@
using System;
using System.Windows;
using System.Windows.Data;
using System.Windows.Threading;
namespace Microsoft.Windows.Controls
{
@ -44,7 +45,15 @@ namespace Microsoft.Windows.Controls
// if the text is not being set internally then load the text into the RichTextBox
if (!rtb._textSetInternally)
rtb.TextFormatter.SetText(rtb.Document, (string)e.NewValue);
{
if (!rtb._textSetInternally)
{
Dispatcher.CurrentDispatcher.BeginInvoke(new Action(delegate()
{
rtb.TextFormatter.SetText(rtb.Document, (string)e.NewValue);
}), DispatcherPriority.Background);
}
}
}
private static object CoerceTextProperty(DependencyObject d, object value)

Loading…
Cancel
Save