Jump to content
  • Advertisement
Sign in to follow this  
athono

[.net] I am having some basic compile issues defining a BorderBrush.

This topic is 2612 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
It uses System.Windows.Media.Brush so you'd need the Sytem.Windows.Media namespace rather than System.Windows.Controls (which is where the Brushes are actually contained)

If you're still having problems, have a look at the bottom of that link you posted.

Share this post


Link to post
Share on other sites
The information on the bottom of that page works.
border2.BorderBrush = new SolidColorBrush(Colors.Green);
works

I wonder why
border2.BorderBrush = new SolidColorBrush(Colors.Lime);
does not work since "Lime" is an option color in XAML but not in CS

Share this post


Link to post
Share on other sites
Color.Lime from System.Drawing
Colors.Lime from System.Windows.Media


It's hard to tell what you're trying to do with one line, what you're compiling for (.net version) and whether you're using just c# forms with no wpf etc.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!