Mega Code Archive
From predefined color name in the Colors class
//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
namespace WpfApplication1
{
public partial class SolidColorBrushExample : Window
{
public SolidColorBrushExample()
{
InitializeComponent();
SolidColorBrush brush = new SolidColorBrush();
// From predefined color name in the Colors class:
brush = new SolidColorBrush(Colors.Green);
rect2.Fill = brush;
}
}
}