TextBlock.SelectionHighlightColor Property


Gets or sets the brush used to highlight the selected text.

Equivalent WinUI property: Microsoft.UI.Xaml.Controls.TextBlock.SelectionHighlightColor.

 property SolidColorBrush ^ SelectionHighlightColor { SolidColorBrush ^ get(); void set(SolidColorBrush ^ value); };
SolidColorBrush SelectionHighlightColor();

void SelectionHighlightColor(SolidColorBrush value);
public SolidColorBrush SelectionHighlightColor { get; set; }
var solidColorBrush = textBlock.selectionHighlightColor;
textBlock.selectionHighlightColor = solidColorBrush;
Public Property SelectionHighlightColor As SolidColorBrush
<TextBlock SelectionHighlightColor="{StaticResource resourceName}"/>
- or -
<TextBlock SelectionHighlightColor="colorString"/>

Property Value


The brush used to highlight the selected text. The default is a null brush from a pure code perspective, but the system uses base text styles to supply a runtime value for apps (unless you specifically override that style). The practical default is a brush using the theme resource TextSelectionHighlightThemeColor.



If using a keyboard for text selection within a TextBlock, the user must first activate Caret Browsing (with the app in the foreground, press F7).

Applies to

See also