Border
Consider the Border
control as a special container that draws a border around the child control, with the specified color, thickness, and corner radius. The following XAML code draws a red border with a depth of 3 around a rectangle:
Changes are immediately visible in the Visual Studio designer. Notice that the Border
can nest just one child element, so if you want to add multiple visual elements, you need to encapsulate them within a container such the Grid
or StackPanel
. Figure 32.1 shows the result of the preceding code.
In the preceding code the BorderBrush
is assigned with a SolidColorBrush
(Red
), but according to the hierarchical logic of XAML, you could set it with a different brush such as LinearGradientBrush
.
3.19.63.106