Answers to similar questions conclude that setting FlowDocument PageWidth to a large number is the simplest way to effectively programatically disable the auto-word wrapping feature in WPF RichTextBox. There are at least 2 unique issues with this: firstly an arbitrary word wrap threshold; secondly a fixed horizontal scrollbar that does not automatically adjust to the width of the content.
After some testing, I found that the maximum allowable value for PageWidth is only 1,000,000 despite it being a double.
This is what I am considering using, but it looks like a bodge job and it has the disadvantages I mentioned above:
//Disable auto-word wrap
MainRtb.Document.PageWidth = 1000000d;
//Enable auto-word wrap
MainRtb.Document.PageWidth = double.NaN; //default value
Any alternative methods for disabling/enabling word wrap programatically?