MSDN Community – UWP UI API

Overview

The Universal Windows Platform (UWP) provides a rich set of UI controls and layout panels that enable developers to create adaptive, modern experiences across all Windows 10 devices.

Namespaces

  • Windows.UI.Xaml
  • Windows.UI.Xaml.Controls
  • Windows.UI.Xaml.Media
  • Windows.UI.Xaml.Input
  • Windows.UI.Xaml.Automation

Key Classes

ClassDescription
ButtonStandard clickable button.
TextBoxEditable text input.
GridFlexible 2‑D layout container.
StackPanelLinear layout (vertical/horizontal).
ListViewScrollable list of items with selection.

Common Controls

Button
CheckBox
RadioButton
ComboBox
Slider

Layout System

UWP offers several layout panels to arrange UI elements responsively:

  • Grid – rows and columns.
  • RelativePanel – position relative to other elements.
  • StackPanel – linear stacking.
  • Canvas – absolute positioning.

Styling & Themes

Control appearance is driven by ResourceDictionary objects and system themes (Light/Dark). Use ThemeResources to reference system colors.

<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Button Content="Click me" Style="{StaticResource PrimaryButtonStyle}" />
    </Grid>
</Page>

Sample Code

Below is a minimal UWP page that demonstrates a button with a click handler.

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

public sealed partial class MainPage : Page
{
    public MainPage()
    {
        this.InitializeComponent();
        MyButton.Click += OnButtonClick;
    }

    private void OnButtonClick(object sender, RoutedEventArgs e)
    {
        ResultText.Text = "Button clicked!";
    }
}

XAML markup:

<Page
    x:Class="SampleApp.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <StackPanel Padding="24">
        <Button x:Name="MyButton" Content="Press me" Width="200" />
        <TextBlock x:Name="ResultText" Margin="0,12,0,0" FontSize="16"/>
    </StackPanel>
</Page>

Additional Resources