Hands on UWP-Universal WIndows Platform
Before we start with the understanding of Hands-On UWP, we should know-
- Understanding of UWP
- Understanding of an Visual Studio IDE (Optional)
Hands- On UWP (Universal Windows Platform)
Before starting anything make sure to enable the Development from the Windows Settings
Go to Settings > Update & Security > For Developers > “Select the Developer Mode” from the list of Developer Features.
Let’s dive in to create a Hello Word UWP Application.
- Open Visual Studio (I’ll be using Visual Studio 2019 for this article).
Note: The IDE is Visual Studio Community Edition, not the Visual Studio Code (It’s a smart Text Editor)
- After opening Visual Studio, click on Create a New Project
- On the next screen, Search for “UWP” in the top given search bar and then select “Blank App (Universal Windows)”, then simply click on Next
- Give your project a name, then click on Next
- Here we can select the versions accordingly, but for this demo, I’m keeping it untouched.
- Here we can see that there are 2 important files in the name of “MainPage”
- FrontEnd: MainPage.xaml
- Backend: xaml.cs
- Now after opening the FrontEnd file, here are again 2 views,
- Code View (We’ll use this view for this demo)
- Design View
- Now place the below code in the Code View of the MainPage.xaml file.
- FornEnd Code for the Button and the TextBox:
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBox Text="Press the Below Button" x:Name="btnCounter"
Height="200" Width="500" FontSize="45" IsEnabled="False" />
<Button x:Name="clickBtn" Content="Click Me"
Height="200" Width="500" FontSize="100" Background="Aqua" />
- Now double click on the Button from the Designer Panel, what this will do?
- It will automatically create a function inside the Backend file (i.e. MainPage.xaml.cs) which will be triggered automatically after the button is clicked.
- Use the code in the selected fields from the Image.
- Now press F5 key to run the program.
Thank you so much for tuning in. Stay tuned for further articles, I’ve got something really exciting on UWP in the next series of Articles.
Conclusion - In this article, we have learned about:
- Created a UWP Hello World Application
- Used XAML language for Front End
- C# for the Backend