Windows API Reference

Universal Windows Platform (UWP) - Basics

Basics of UWP APIs

The Universal Windows Platform (UWP) provides a rich set of APIs for building modern, high-quality applications that can run across the Windows ecosystem. This section introduces the fundamental concepts and APIs that form the foundation of UWP development.

Core Concepts

Understanding these core concepts is crucial for effective UWP development:

Application Model

The UWP application model governs how applications are packaged, activated, and managed. Key components include:

Activation Example

The OnLaunched method in your App.xaml.cs is the primary entry point for an activated application.

public partial class App : Application { protected override void OnLaunched(LaunchActivatedEventArgs e) { if (e.PrelaunchActivated == false) { Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } rootFrame.Navigate(typeof(MainPage), e.Arguments); } Window.Current.Activate(); } }

UI and Controls

UWP provides a comprehensive set of UI elements and layout panels for creating responsive and visually appealing interfaces.

XAML Button Example

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

Data Access

UWP offers various ways to store and retrieve data:

Local Settings Example

var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; localSettings.Values["mySetting"] = "someValue"; object savedValue = localSettings.Values["mySetting"];

Communication

UWP enables various communication patterns:

Next Steps

This overview covers the basics. To delve deeper, explore the following resources: