Create First Hello World App On Universal Windows Platform (UWP)

Here are the steps,

Step 1: Create a new project. Go to File, New, then Project. Under Visual C# > Universal, select Blank App (Universal Windows). Name it “Hello World” and click OK.

Blank App

Step 2: You have created your application. Now in the Solution explorer you’ll see MainPage.xaml (To open Solution Explorer Go to View > Solution Explorer or Press Ctrl+W, S).

Solution Explorer

Step 3: Go to the MainPage.xaml. It is a designer where you can add all the controls like Button, Images, Medias, Inputs, etc. Visual Studio 2015 has provided a cool feature here. We can design for different devices such as Phones, Tablets, Desktop, Xbox, Surface Hub and IoT Devices.

Right now we are developing for Windows Tables/PCs, so we’ll select Tablet.

Go to the MainPage


Step 4: Drag a TextBlock from Toolbox and put it in designer. In an Xaml, we can create this TextBlockcontrol using Xaml code.


Step 5: Change the Text to "Hello World" in the XAML Editor and font size to 50.

Hello World

In XAML, our code looks like the following:
  1. <Page    
  2.     x:Class="HelloWorld.MainPage"    
  3.     xmlns=""    
  4.     xmlns:x=""    
  5.     xmlns:local="using:HelloWorld"    
  6.     xmlns:d=""    
  7.     xmlns:mc=""    
  8.     mc:Ignorable="d">    
  10.     <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">    
  11.         <TextBlock x:Name="textBlock" HorizontalAlignment="Left" Margin="380,244,0,0" TextWrapping="Wrap" Text="HelloWOrld" FontSize="50" VerticalAlignment="Top"/>   
  12.     </Grid>    
  13. </Page>  
Step 6: Now you are ready to run your application. Press F5 or you can click Local Machine to run. Here you have different choices where you want to run your application. You can run on your phone device, Local Machine, Emulators, etc.


You’ll see Universal Windows app running. That’s it.

Universal Windows app running


Similar Articles