I am having some basic compile issues defining a BorderBrush in my Silverlight C# file.

I am having some basic compile issues defining a BorderBrush in my Silverlight C# file.

I am having some basic compile issues defining a BorderBrush in my Silverlight C# file.

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?

The Reddest
10/25/2011 - 08:26

The Brushes class is in the System.Windows.Media namespace. Add that to the top of the file with a "using" statement.

reply

Add Comment

Put code snippets inside language tags:
[language] [/language]

Examples:
[javascript] [/javascript]
[actionscript] [/actionscript]
[csharp] [/csharp]

See here for supported languages.

Javascript must be enabled to submit anonymous comments - or you can login.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.