I am having some basic compile issues defining a BorderBrush.

Discussion in 'Silverlight' started by Zhang JingChu, Oct 20, 2011.

  1. 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?
     
  2. The MS page you referenced is for WPF not Silverlight. I'm with you though, MSDN documentation is quite often misleading or sometimes just makes no sense at all.

    In Silverlight you'd do something like this to create a border brush in code:
    border.BorderBrush = new SolidColorBrush(Colors.SlateBlue));
     

Share This Page