DataGridTextColumn.Foreground Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the brush that is used to paint the text contents of cells in the column.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.Data (in System.Windows.Controls.Data.dll)

Syntax

'Declaration
Public Property Foreground As Brush
public Brush Foreground { get; set; }
<sdk:DataGridTextColumn>
  <sdk:DataGridTextColumn.Foreground>
    singleBrush
  </sdk:DataGridTextColumn.Foreground>
</sdk:DataGridTextColumn>
<sdk:DataGridTextColumn Foreground="colorString"/>

XAML Values

  • singleBrush
    Within opening and closing property elements for sdk:DataGridTextColumn.Foreground, exactly one object element for an object that derives from Brush. The object element is typically one of the following classes defined by Silverlight: LinearGradientBrush, RadialGradientBrush, ImageBrush, SolidColorBrush, VideoBrush.

  • colorString
    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 XAML Values section in Color.

Property Value

Type: System.Windows.Media.Brush
The brush that is used to paint the contents of cells in the column. The default is nulla null reference (Nothing in Visual Basic).

Exceptions

Exception Condition
NullReferenceException

The Foreground value has not been set.

Remarks

If you do not explicitly set the DataGridTextColumn.Foreground property, the first non-null Foreground property specified in the visual tree is used for display, but the DataGridTextColumn.Foreground property returns nulla null reference (Nothing in Visual Basic).

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.