Overview of this article

Before you start…

Step 1: Create a new project in Visual Studio

Step 2: Modify your start page

Step 3: Start the app

Step 4: Create an event handler

Step 5: Adapt the UI to different window sizes Summary

This tutorial is for the windows 10 absolute beginners. In this tutorial you will learn how to create Universal Application Project (UAP) for different Microsoft devices using a single code project.

Note: Make sure for UAP Development you need a windows 10 OS and Microsoft Visual Studio 15.

Step 1: Create a new project in Visual Studio

  1. Launch Visual Studio 2015.The Visual Studio 2015 Start page appears. (From now on, we’ll refer to Visual Studio 2015 simply as Visual Studio .)
  2. On the File menu, select New > Project.The New Project dialog appears. The left pane of the dialog lets you select the type of templates to display.
  3. In the left pane, expand Installed > Templates > Visual C# > Windows, then pick the Universal template group. The dialog’s center pane displays a list of project templates for Universal Windows Platform (UWP) apps.
    windows 10 app development
  4. In the center pane, select the Blank App (Universal Windows) template.The Blank App template creates a minimal UWP app that compiles and runs, but contains no user-interface controls or data. You add controls to the app over the course of this tutorial.
  5. In the Name text box, type “HelloWorld”.
  6. Click OK to create the project.
    Visual Studio creates your project and displays it in the Solution Explorer.

Step 2: Modify your start page

  1. Double-click MainPage.xaml in Solution Explorer to open it.
  2. In the XAML editor, add the controls for the UI.In the root Grid, add this XAML. It contains a StackPanel with a title TextBlock, a TextBlock that asks the user’s name, a TextBox element to accept the user’s name, a Button, and another TextBlock to show a greeting. Some of these controls have names so that you can refer to them later in your code.
    
    

Step 3: Start the app

At this point, you’ve created a very simple app. This is a good time to build, deploy, and launch your app and see what it looks like.

You can debug your app on the local machine, in a simulator or emulator, or on a remote device. Here’s the target device menu in Visual Studio.

Step 4: Create an event handler

    1. In XAML or design view, select the “Say Hello” Button that you added to MainPage.xaml.
    2. In the Properties Window, click the Events button (Events button).
    3. Find the Click event at the top of the event list. In the text box for the event, type the name of the function that handles the Click event. For this example, type “Button_Click”.
    4. Press Enter. The event handler method is created and opened in the code editor so you can add code to be executed when the event occurs.In the XAML editor, the XAML for the Button is updated to declare the Click event handler like this.
      
      

 

  • Add code to the event handler that you created in the code-behind page. In the event handler, retrieve the user’s name from the nameInput TextBox control and use it to create a greeting. Use the greetingOutput TextBlock to display the result.
    private void Button_Click(object sender, RoutedEventArgs e)
    {
        greetingOutput.Text = "Hello, " + nameInput.Text + "!";
    }

 

That’s All. Now you are not an absolute beginner :). Happy Coding.