Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Border Class

Draws a border, background, or both around another element.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:

public ref class Border : public Decorator
public class Border extends Decorator
public class Border extends Decorator

Content Model: Border can have only one child. To display multiple child elements, you need to place an additional Panel element within the parent Border. You can then place child elements within that Panel element.

If you want to display a border around your content, you must place the elements within a parent Border element.

The following example demonstrates how to create a Border and set properties in code and.

myBorder = gcnew Border();
myBorder->Background = Brushes::LightBlue;
myBorder->BorderBrush = Brushes::Black;
myBorder->BorderThickness = Thickness(2);
myBorder->CornerRadius = CornerRadius(45);
myBorder->Padding = Thickness(25);

<Border Background="LightBlue" 

More Code

How to: Wrap a Border Around the Content of a Canvas

This example shows how to wrap a Canvas element with a Border.

How to: Change Border Properties

This example shows how to change the Background color of a Border element.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

© 2017 Microsoft