Unplanned
Last Updated: 05 Oct 2022 20:50 by Adam
Adam
Created on: 05 Oct 2022 06:55
Category: RichTextBox
Type: Bug Report
0
RichTextBox: Setting the margin of the DocumentPrintLayoutPresenter breaks the selection.
Setting the margin of the DocumentPrintLayoutPresenter breaks the selection. 
1 comment
Adam
Posted on: 05 Oct 2022 20:50

A decent workaround is to use the code-behind to force the Presenter's horizontal alignment to Left. It doesn't look as nice as centered, but maintains the text selection.

 

static void OnLoaded(object sender, RoutedEventArgs args)
{
    if (sender is not RadRichTextBox rrtb) return;

    rrtb.Loaded -= OnLoaded;
    rrtb.EnsureActiveEditorPresenter();
    if (rrtb.ActiveEditorPresenter is FrameworkElement presenter)
    {
        presenter.ClearValue(HorizontalAlignmentProperty);
    }
}