How can I bind a background color in WPF/XAML?

Important:

Make sure you’re using System.Windows.Media.Brush and not System.Drawing.Brush

They’re not compatible and you’ll get binding errors.

The color enumeration you need to use is also different

System.Windows.Media.Colors.Aquamarine (class name is Colors) <— use this one

System.Drawing.Color.Aquamarine (class name is Color)

If in doubt use Snoop and inspect the element’s background property to look for binding errors – or just look in your debug log.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)