Control.Foreground Property
.NET Framework (current version)
Gets or sets a brush that describes the foreground color.
Assembly: PresentationFramework (in PresentationFramework.dll)
Property Value
Type: System.Windows.Media.BrushThe brush that paints the foreground of the control. The default value is the system dialog font color.
The following example shows how to set the font style property of a control.
<Button Name="btn1" Foreground="Black" Click="ChangeForeground"> Foreground </Button>
Private Sub ChangeForeground(ByVal Sender As Object, ByVal e As RoutedEventArgs) If (Equals(btn1.Foreground, Brushes.Green)) Then btn1.Foreground = Brushes.Black btn1.Content = "Foreground" Else btn1.Foreground = Brushes.Green btn1.Content = "Control foreground(text) changes from black to green." End If End Sub
.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Show: