Foreground property
Collapse the table of content
Expand the table of content

RichTextBlock.Foreground property

Gets or sets the Brush to apply to the text contents of the RichTextBlock.


public Brush Foreground { get; set; }

<RichTextBlock Foreground="{StaticResource resourceName}"/>

<RichTextBlock Foreground="colorString"/>


XAML Values


The resource name (x:Key attribute value) of an existing XAML resource that defines a brush. This is the recommended way to specify Brush values in XAML if you have any intention of using the same colors or brushes in more than one part of your UI. See Remarks in Brush or ResourceDictionary and XAML resource references.


The Color for a SolidColorBrush expressed as an attribute string. This can be a named color, an RGB value, or an ScRGB value. RGB or ScRGB may also specify alpha information. See the "XAML Values" section in Color.


Within opening and closing property elements, exactly one object element for an object that derives from Brush. This is typically one of the following classes: LinearGradientBrush, ImageBrush, SolidColorBrush.

Property value

Type: Brush

The brush used to apply to the text contents. The default is a null brush from a pure code perspective, but the default text styles set this to Black (for Light theme) or White (for Dark theme) for a TextBlock element in UI.


Set the Foreground property to specify the default brush to use for all text in the RichTextBlock. You can override this value for specific text elements (such as a Run) in the RichTextBlock by setting the TextElement.Foreground property.

The default appearance of text and text styles depends heavily on the active theme and other settings. The theme and various styles and behaviors that are using default system settings or user preferences are the source of the effective runtime appearance of RichTextBlock foreground color of text as well as other text characteristics. You can change these defaults by changing the property values, or by applying a different style to specific RichTextBlock instances. You can change the foreground value for all default text by overriding the resource named DefaultTextForegroundThemeBrush in App.xaml.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::UI::Xaml::Controls [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]


Windows::UI::Xaml::Controls [C++]



See also

Use brushes



© 2016 Microsoft