Can I select a TextBox with a different font color?

Styling is a big feature of WPF. Is it possible to make a text box look like an OS text box?

I’m tired of the gloomy unsaturated color that a choice must have so that black text is visible:

textbox selection comparison

Is this a fix?

+7
source share
2 answers

Unfortunately, this may not be possible, the selection is made using the superimposed rectangle (brilliant idea, isn't it?), It makes it difficult even to get the selected background color, required while maintaining the readability of the text. (Try setting SelectionOpacity to 1 )

Also, the selected part of the text does not look in style, so changing the foreground color of the selection is also impossible.

+6
source

Maybe you need SelectionBrush ? This is a dependency property. (Not sure if it is available in .NET version 4).

To find out what the current system colors are, you can use the SystemColors class .

See an example here: WPF SystemColors: TextBox border color .

+1
source

All Articles