I am having some basic compile issues defining a BorderBrush.

http://msdn.microsoft.com/en-us/library/system.windows.controls.border.borderbrush.aspx
states that you define a borderbrush like this:

myBorder1 = new Border();
myBorder1.BorderBrush = Brushes.SlateBlue;


but in my code, when I try
border1.BorderBrush = Brushes.SlateBlue;
I get
Error 1 The name 'Brushes' does not exist in the current context
and I have included the namespace
System.Windows.Controls
as a "using" statement at the top of the file
as well as a Reference to the project.
What am I missing?

Recommended Answers

All 3 Replies

Brushes is in System.Windows.Media. The IDE should have put a red underline at the beginning of Brushes and you could hover your mouse over it, click the pop-up and you'd see the option to add the proper using statement.

How do I test to see what a borderbrush is set to in Silverlight C#?
(border3.BorderBrush != Colors.Red)
does not work

Depends on the type of brush it is, as not all of them have a color.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.