UWP UI Reference

This section provides detailed reference documentation for Universal Windows Platform (UWP) UI elements, controls, and related APIs.

Core UI Elements

TextBlock

Displays plain text. Supports rich text formatting.

TextBlock()

Properties

Example

XAML

<TextBlock Text="Hello, UWP!" FontSize="24" FontWeight="Bold" Foreground="DarkBlue"/>

Image

Displays an image from a specified source.

Image()

Properties

Example

XAML

<Image Source="ms-appx:///Assets/logo.png" Stretch="Uniform"/>

Common Controls

Button

A clickable control that triggers an action.

Button()

Properties

Events

Example

XAML

<Button Content="Click Me" Click="OnButtonClick"/>

C# (Code-behind)

private void OnButtonClick(object sender, RoutedEventArgs e)
{
    // Handle button click
    System.Diagnostics.Debug.WriteLine("Button clicked!");
}

TextBox

Allows users to enter and edit text.

TextBox()

Properties

Events

Layout Panels

StackPanel

Arranges child elements in a single line, either horizontally or vertically.

StackPanel()

Properties

Example

XAML

<StackPanel Orientation="Horizontal" Spacing="10">
    <TextBlock Text="Item 1"/>
    <TextBlock Text="Item 2"/>
</StackPanel>

Grid

Defines a flexible grid-based layout system.

Grid()

Properties

Elements within a Grid can be positioned using Grid.Row and Grid.Column attached properties.

Further Information

For more comprehensive details on UWP UI development, please refer to the official Microsoft UWP documentation.