-api-id | -api-type |
---|---|
T:Windows.UI.Xaml.Controls.Border |
winrt class |
Draws a border, background, or both, around another object.
<Border>
singleChild
</Border>
Border is a container control that draws a border, background, or both, around another object. Here's a gray border around two rectangles.
You can specify basic properties of a Border by setting its Width, Height, BorderBrush, BorderThickness, and Background color. In addition, you can round the border corners by setting the CornerRadius property, and you can position the object inside the Border by setting the Padding property.
A Border can contain only one child object. If you want to put a border around multiple objects, wrap them in a container object such as StackPanel.
Windows version | SDK version | Value added |
---|---|---|
1809 | 17763 | BackgroundSizing |
1809 | 17763 | BackgroundTransition |
[!div class="nextstepaction"] Open the WinUI 2 Gallery app and see the Border in action
The WinUI 2 Gallery app includes interactive examples of most WinUI 2 controls, features, and functionality. Get the app from the Microsoft Store or get the source code on GitHub.
[!code-xamlBasicBorderXAML]
[!code-xamlLayoutOvwBorder]