I am trying to get and set rich text in a ;RichEditBox, but every time I do perform a GetText then a SetText, one extra carriage return is added. Here the super simple example with a button that does get then set. Try it out to see one extra carriage return being added every time you perform the Get-Set.
XAML
<StackPanel>
<Button Content="Get-Set" Click="OnGetSet"/>
<RichEditBox x:Name="RichEditor" Width="300" Height="200"/>
</StackPanel>
C#
private void OnGetSet(object sender, RoutedEventArgs e)
{
RichEditor.Document.GetText(TextGetOptions.FormatRtf, out value);
RichEditor.Document.SetText(TextSetOptions.FormatRtf, value);
}
I tried all sort of options both in the SetText and in the GetText, but I am able to prevent additional carriage return to be inserted. Does anyone have a suggestion?