Basic Requirements
- Visual Studio 2015
- Windows 10
Click here to set up for UWP development.
Launch Visual Studio and select New Project.
Select Windows, Universal, then Blank App. Click OK and there you have your first UWP application.
Open the MainPage.xaml file.
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.
- <Button Name="ClickMeButton" Content="Click Me" Margin="10,10,0,598" />
- <TextBlock x:Name="MessageTextBlock"
- HorizontalAlignment="Left"
- Margin="10,150,0,0"
- TextWrapping="Wrap"
- Text=""
- VerticalAlignment="Top"
- FontSize="48"/>
Select the button you made and click on Properties and then click on the Event Handler icon.
Double click in the text box labeled as Click.
The code-behind file of MainPage will open up.
Enter the following code in the ClickMeButton_Click function.
- MessageTextBlock.Text = "Hello World";
Click on Local Machine to run your project.
Summary
In this article, we learned about Hello World In the Universal Windows Platform.