Major
4.8
NotPlanned
In WPF applications using non-adorner based text selection for TextBox and PasswordBox, developers may now set the newly added SelectionTextBrush property in order to alter the rendering of the selected text. By default, this color changes with SystemColors.HighlightTextBrushKey. If non-adorner based text selection is not enabled, this property does nothing.
- Quirked
- Build-time break
Once non-adorner based text selection is enabled, you can use the xref:System.Windows.Controls.PasswordBox.SelectionTextBrush?displayProperty=nameWithType and TextBox.SelectionTextBrush property to change the appearance of the selected text. This can be achieved using XAML:
<TextBox SelectionBrush="Red" SelectionTextBrush="White" SelectionOpacity="0.5"
Foreground="Blue" CaretBrush="Blue">
This is some text.
</TextBox>
F:System.Windows.Controls.Primitives.TextBoxBase.SelectionTextBrushProperty
P:System.Windows.Controls.Primitives.TextBoxBase.SelectionTextBrush
- System.Windows.Controls.TextBox
- System.Windows.Controls.PasswordBox
WPF