How to change the selection text foreground color in WPF MS TextBox control
Describe the bug
When we changed the text box selection color using the selection brush property, the foreground color of the selection text was black and the opacity of the selection brush was altered. We then set the selection opacity property to 1, and the selection text was disabled. TextBoxSelectionIssue.zip
Steps to reproduce the bug
- Set the SelectionBrush property.
- Run the sample.
- Note the issue
Expected behavior
When the text box selection color was changed, the opacity of the color did not change, and the selection text color was changed to white
Screenshots
After changing the selection color
After changing the SelectionOpacity
Expected behaviour
NuGet package version
None
Windows version
Windows 11 (22H2): Build 22621
Additional context
No response
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!
Open similar issues:
- Issue occurs for custom control that was inherited from ComboBoxItem (#9620), similarity score: 0.71
Closed similar issues:
- TextBox rapid selection change causes application hang (#7018), similarity score: 0.71
- The Caret brush is white in the Light theme when TextBox/RichEditBox has a transparent background (#9005), similarity score: 0.71
- Selected ListView items especially textbox are shown differently in high constrast theme impacting accessibility. (#8235), similarity score: 0.71
- AutoSuggestBox VisualState Foreground issue (#9029), similarity score: 0.71
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Is there any way to change the selection text foreground color in the textbox control?
I think the dotnet/wpf repo is the right place for WPF questions.