Hi,@WPF-Learner.
When I set AppContext.SetSwitch("Switch.System.Windows.Controls.Text.UseAdornerForTextboxSelectionRendering", false); the TextBox behaves fine and the RichTextBox cannot display the text.
The fact that the switch only applies to TextBox
and PasswordBox
as stated in the docs. It doesn't work for RichTextBox.
At least not using this, or any other, switch. It is recommended that you Set the SelectionOpacity programmatically if you don't want to change the XAML markup.
<RichTextBox Name="richTextBox" Height="80" Grid.Row="1" Width="500" Grid.Column="1" SelectionOpacity="1"></RichTextBox>
codebehind:
richTextBox.SelectionOpacity = 0.7;
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.