Hello World In Universal Windows Platform

Basic Requirements

  • Visual Studio 2015
  • Windows 10

Click here to set up for UWP development.

Launch Visual Studio and select New Project.

New Project
 
Select Windows, Universal, then Blank App. Click OK and there you have your first UWP application.

Blank App
 
Open the MainPage.xaml file.

main page
 
Add a Button and a TextBlock to your view through the toolbar or by adding this XAML code in the Grid tag. Don’t forget to add a Name attribute to them.
  1. <Button Name="ClickMeButton" Content="Click Me" Margin="10,10,0,598" />    
  2. <TextBlock x:Name="MessageTextBlock"    
  3.    HorizontalAlignment="Left"    
  4.    Margin="10,150,0,0"     
  5.    TextWrapping="Wrap"    
  6.    Text=""    
  7.    VerticalAlignment="Top"    
  8.    FontSize="48"/>   
 
Tool Box
 
Select the button you made and click on Properties and then click on the Event Handler icon.

Event Handler
 
Double click in the text box labeled as Click.

Design
 
The code-behind file of MainPage will open up.

Main Page
 
Enter the following code in the ClickMeButton_Click function.
  1. MessageTextBlock.Text = "Hello World";  
Click on Local Machine to run your project.

local machine
 

Summary

 
In this article, we learned about Hello World In the Universal Windows Platform. 


Similar Articles