UWP - Border example

MainPage.xaml

<Page
    x:Class="UniversalAppTutorials.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:UniversalAppTutorials"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <StackPanel 
        x:Name="StackPanel1" 
        Margin="50" 
        Orientation="Vertical"
        Background="AliceBlue"
        Padding="50"
        >
        <Border
            Width="300"
            Height="100"
            BorderBrush="Red"
            BorderThickness="1"
            HorizontalAlignment="Left"
            Margin="5"
            />
        <Border
            Width="400"
            Height="150"
            BorderBrush="SeaGreen"
            BorderThickness="2"
            CornerRadius="20,15,10,5"
            HorizontalAlignment="Left"
            Margin="5"
            />
        <Border
            Width="300"
            Height="100"
            BorderBrush="Orchid"
            BorderThickness="5"
            CornerRadius="25"
            HorizontalAlignment="Left"
            Margin="5"
            />
        <Border
            Width="250"
            Height="200"
            BorderBrush="Crimson"
            BorderThickness="10"
            HorizontalAlignment="Left"
            Margin="5"
            Background="Aqua"
            />
    </StackPanel>
</Page>
MainPage.xaml.cs

using Windows.UI.Xaml.Controls;
using Windows.UI;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml;


namespace UniversalAppTutorials
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();

            // Create a Border programmatically
            CreateBorder();
        }

        private void CreateBorder()
        {
            // Initialize a new Border
            Border border = new Border();

            // Set border brush/color
            border.BorderBrush = new SolidColorBrush(Colors.Blue);

            // Set border thickness
            border.BorderThickness = new Thickness(3);

            // Set border width and height
            border.Width = 300;
            border.Height = 100;

            // Set border horizontal alignment
            border.HorizontalAlignment = HorizontalAlignment.Left;

            // Finally, add the border to layout
            StackPanel1.Children.Add(border);
        }
    }
}
More uwp tutorials