Basically, I have a button, that, when pressed, should change another label's text color. However, whenever I try to run it, I get the error:
'Label' does not contain a definition for 'ForeColor' and no extension method 'ForeColor' accepting a first argument 'Label' could be found (are you missing a using directive or an assembly reference?)
private void Button_Click(object sender, RoutedEventArgs e)
tlabel.ForeColor = System.Drawing.Color.Red;
The property is called
Foreground and it's a
Brush, not a
tlabel.Foreground = System.Windows.Media.Brushes.Red;
The advantage of using a brush instead of a color is that red is just red, but a
Brush could be a lot of things. The system brush I showed you is a
SolidColorBrush -- just red -- but there are various gradient brushes, ImageBrushes, and so on.
System.Drawing is a windows forms namespace, not WPF.
ForeColor is a windows forms property as well. Make sure the documentation you're looking at is for WPF, not windows forms.