Hello World In Universal Windows Platform

Basic Requirements

  • Visual Studio 2015
  • Windows 10

Click here to setup for UWP development.

  1. Launch Visual Studio and select New Project.

    New Project

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

    Blank App

  3. Open the MainPage.xaml file.

    main page

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

  5. Select the button you made and click on Properties and then click on Event Handler icon.

    Event Handler

  6. Double click in the text box labeled as Click.

    Design

  7. Code behind file of MainPage will open up.

    Main Page

  8. Enter the following code in ClickMeButton_Click function.

    MessageTextBlock.Text = "Hello World";

  9. Click on Local Machine to run your project.

    local machine

Next Recommended Readings