MSDN Community

Your Hub for Microsoft Development

Get Started with Universal Windows Platform (UWP)

Welcome to the Universal Windows Platform (UWP)! UWP allows you to build apps that run across a wide range of Windows 10 and Windows 11 devices, from PCs and tablets to Xbox and HoloLens. This guide will walk you through the essential steps to begin your UWP development journey.

1

Install Development Tools

The primary tool for UWP development is Visual Studio. Ensure you have the latest version installed. During installation, select the "Universal Windows Platform development" workload.

Requirements:

  • Windows 10 or Windows 11
  • Visual Studio (Community, Professional, or Enterprise edition)
Download Visual Studio
2

Create Your First UWP App

Once Visual Studio is set up, you can create your first UWP project. Choose a template that suits your needs, such as a Blank App.

Steps in Visual Studio:

  1. Open Visual Studio.
  2. Click "Create a new project".
  3. Search for "Blank App (Universal Windows)".
  4. Select the C# or C++ version.
  5. Name your project and choose a location.
  6. Click "Create".

This will generate a basic project structure for your UWP application.

3

Understanding the Project Structure

A typical UWP project includes:

  • App.xaml / App.xaml.cs: The entry point of your application.
  • MainPage.xaml: The main UI layout file for your app.
  • MainPage.xaml.cs: The code-behind file for the main page.
  • Package.appxmanifest: Contains metadata about your app package.

You'll use XAML for defining the UI and C# (or another .NET language) for application logic.

4

Designing Your User Interface (UI)

UWP uses XAML (Extensible Application Markup Language) to define the UI. You can use the Visual Studio designer or edit the XAML directly.

Example XAML for a simple button:

<Button Content="Click Me" HorizontalAlignment="Center" VerticalAlignment="Center" />

Explore controls like Grid, StackPanel, TextBlock, and TextBox to build rich user experiences.

5

Running and Debugging

You can run your UWP app locally on your development machine or deploy it to a physical device.

  • Select "Local Machine" from the Visual Studio debugger dropdown.
  • Press F5 or click the "Start" button to run your app.

Use the built-in debugging tools in Visual Studio to step through your code, inspect variables, and identify issues.

Next Steps

Now that you've set up your environment and created a basic app, you can dive deeper: