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="Horizontal"
Background="AliceBlue"
Padding="50"
>
<!--- Display symbol icon using XAML -->
<SymbolIcon
Symbol="AddFriend"
Margin="25"
/>
<!--- Display symbol icon on a button -->
<Button Padding="10">
<StackPanel Orientation="Horizontal">
<SymbolIcon Symbol="Save"/>
<TextBlock Text="Save" Margin="15,0,0,0"/>
</StackPanel>
</Button>
</StackPanel>
</Page>
MainPage.xaml.cs
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml;
namespace UniversalAppTutorials
{
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
// Initialize a new SymbolIcon instance
SymbolIcon symbolIcon = new SymbolIcon(Symbol.Admin);
// Set the margin of symbol icon
symbolIcon.Margin = new Thickness(25);
// Finally, put the symbol icon on stack panel
// Programmatically create and display symbol icon
StackPanel1.Children.Add(symbolIcon);
}
}
}

- UWP - How to add a new line to a TextBlock
- UWP - How to bold text in a TextBlock
- UWP - How to underline text in a TextBlock
- UWP - How to change TextBlock background color
- UWP - Border example
- UWP - Polyline example
- UWP - Line example
- UWP - Add border to an Ellipse
- UWP - Create an Ellipse programmatically
- UWP - ComboBox alternate item color
- UWP - ListView ItemTemplate example
- UWP - ListView HeaderTemplate example
- UWP - How to add margin to each item in a ListView
- UWP - How to use ListView item click event
- UWP - Horizontal ListView example