Expand Minimize

TextBlock.Foreground property

Applies to Windows and Windows Phone

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

Syntax


public Brush Foreground { get; set; }


<TextBlock>
  <TextBlock.Foreground>
    singleBrush
  </TextBlock.Foreground>
</TextBlock>


<TextBlock Foreground="colorString"/>

XAML Values

singleBrush

A single object element for an object that derives from Brush. The object element is typically one of the following classes that are: LinearGradientBrush, ImageBrush, SolidColorBrush.

colorString

The Color for a SolidColorBrush expressed as a string value for the attribute. This can be a named color, an RGB value, or an ScRGB value. RGB or ScRGB values can also specify alpha information. For more information, see the "XAML Values" and "Predefined Colors" sections in Brush.

Property value

Type: Brush

The brush used to apply to the text contents. The default is a SolidColorBrush with a Color value of Black.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

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

Metadata

Windows.winmd

See also

TextBlock

 

 

Show:
© 2014 Microsoft