DataGridTextColumn.Foreground Property

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)

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 null.

ExceptionCondition
NullReferenceException

The Foreground value has not been set.

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 null.

Silverlight

Supported in: 5, 4, 3

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

Community Additions

ADD
Show: