I have seen this question:
How to keep WPF TextBox selection when not focused?
And have implemented the solution there, so that my textbox shows the selection, even when it does not have focus.
However, when I change the selection start or length, nothing changes visually in the textbox. Also, when I scroll the textbox programatically and it does not have focus, the selection brush does not move with the text as it scrolls.
If you define a separate focus scope in XAML to maintain the selection (see StackPanel below) and you set the focus in the TextBox once (in this case when the Window opens using FocusManager.FocusedElement) then you should see your selection change programatically.
Here is some sample code to get you started:
Here is some code to handle the button click event: