Draws a border, background, or both around another element.
Public Class Border _ Inherits Decorator
Dim instance As Border
public class Border : Decorator
public ref class Border : public Decorator
public class Border extends Decorator
<Border> Child </Border>
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 Extensible Application Markup Language (XAML).
Dim myBorder As New Border myBorder.Background = Brushes.LightBlue myBorder.BorderBrush = Brushes.Black myBorder.BorderThickness = New Thickness(2) myBorder.CornerRadius = New CornerRadius(45) myBorder.Padding = New Thickness(25)
myBorder = new Border(); myBorder.Background = Brushes.LightBlue; myBorder.BorderBrush = Brushes.Black; myBorder.BorderThickness = new Thickness(2); myBorder.CornerRadius = new CornerRadius(45); myBorder.Padding = new Thickness(25);
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" BorderBrush="Black" BorderThickness="2" CornerRadius="45" Padding="25">
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003