Skip to main content
September 16, 2015
IoT

Learn about the samples for Universal Windows Platform



One way to learn app development for the Universal Windows Platform (UWP) is by taking advantage of the extensive and growing samples collection on GitHub. You can use these samples to learn about specific UWP features and APIs and as a source of working code that you can copy and paste into your projects.

These samples include API and feature demos as well as some small but complete apps that show you how to combine multiple features in a more realistic setting.

Many of the samples are available in C#, JavaScript, and C++, so you can find the most familiar code . Because they are UWP apps targeting the universal device family, they will also run on the entire range of supported devices, including desktop computers, tablets, phones, Xbox consoles, Surface Hubs, and HoloLens devices.

API and feature samples

The API and feature samples collection covers numerous scenarios ranging across the entire platform. For convenient browsing, the 190-plus samples are divided into these categories:

  • App settings
  • Audio, video, and camera
  • Communications
  • Contacts and calendar
  • Controls, layout, and text
  • Custom user interactions
  • Data
  • Deep links and app-to-app communication
  • Devices and sensors
  • Files, folders, and libraries
  • Gaming
  • Globalization and localization
  • Graphics and animation
  • Identity, security, and encryption
  • Launching and background tasks
  • Maps and location
  • Navigation
  • Networking and web services
  • Platform architecture
  • Speech and Cortana
  • Threading
  • Tiles, toasts, and notifications

If you are new to development or new to the Windows platform, these samples are a great place to start. Just by running and exploring them, you can get a great idea of the available features. You can learn even more by experimenting with the code while reading the UWP documentation on the dev center. Each sample has a README.md file that describes the scenarios it covers and provides links to the related feature docs. The following sections show some examples of what you’ll find in our Windows-universal-samples collection.

XAML

The XAML UI basics sample shows the different XAML controls and layout panels available.

1_sampleUiBasic

Other XAML-specific samples provide more detail on specific controls or scenarios, such as ListView and GridView, Pivot, and navigation patterns.

Direct2D

The Direct2D photo adjustment sample shows how to use Direct2D to manipulate images.

2_direct2d

Other Direct2D samples cover custom image effects and gradient meshes. Of course, there are Direct3D samples in this collection as well, plus a separate DirectX-Graphics-Samples collection.

Map

The MapControl sample shows how we’ve combined the different mapping features available in earlier platforms into a new, unified experience that works across all supported devices.

3_maps

These are just a few examples of the many API and feature samples available, ranging from networking samples to audio/video/camera and Cortana samples. See the Windows-universal-samples collection for more info. If you don’t see a sample you’re looking for, or you have any feedback on the existing samples, let us know via the Issues list. We’re updating the samples collection on a weekly basis, so check back regularly for the latest changes.

Bringing the features together into real apps

When you start to build your apps, you might wonder how these platform features can work together to form more compelling scenarios. This is where our full app samples come into play.

These samples are fully functional, but small enough to learn from without too much distracting complexity. The goal here is to combine 3 or 4 platform features in each app – just enough to demonstrate how to solve some problems that arise in the real world, such as data management and code organization.

Each of these samples is intentionally missing the kind of polish you will need in a successful app, such as compelling tiles, splash screens, and sharing capabilities. This simplification makes them suitable both for easier learning and for forming the basis of your apps. You can copy any or all of the code from these apps into your own projects, which you can then extend, turning them into your own unique apps that you can publish to the Windows Store and monetize.

App samples

Currently, there are only a few real-world app samples, but more are in the works.

TrafficApp shows how to build a traffic monitoring app by combining the MapControl, location and route services, background tasks, and toast notifications. Although this app uses a conventional code-behind structure, it demonstrates some organizational best practices with a reusable LocationHelper component that can help you build similar apps.

4_traffic

RSS Reader shows how to build a news app using the syndication APIs, serialization and local storage, and an adaptive layout. This app also demonstrates best practices by using a basic Model-View-ViewModel (MVVM) architecture.

5_rssFeeder

QuizGame shows how to use networking features to build a pub-style trivia game where questions aredisplayed on a big screen while players answer the questions on their own devices. This demonstrates how the same app instance can effectively run simultaneously on multiple devices in direct communication with one-another.

6_quizApp

The screenshot below shows the app in test mode where you can see the host UI on the left and two copies of the client UI on the right, before and after a question is answered. Although the UI is simple, this sample provides a well-architected basis for building similar apps, and uses a more elaborate MVVM architecture and a reusable peer-to-peer helper component.

Like the API and feature samples collection, each of these app samples has its own Issues list on GitHub that you can use to provide feedback or request changes. If there are any scenarios you’d like to see in the form of a small-but-complete sample app, just add a comment to this blog post or to any of the Issues lists on the GitHub pages for the samples.