Suma 1.0

Using Visual Studio and the C# programming language we will build a Universal Windows Platform application that computes the sum of two numbers.

Start

Launch Visual Studio. Create a new project from the menu via: File > New > Project, or use the shortcut Ctrl + Shift + N. In the dialog that appears choose: Visual C# > Windows Universal > Blank App (Universal Windows). Name the project Suma 1.0.

Fig. 1.22. Selecting the Windows version

From Solution Explorer open MainPage.xaml and MainPage.xaml.cs. If you don't see Solution Explorer, open it from View > Solution Explorer or use the shortcut Ctrl + W, S.

MainPage.xaml

The MainPage.xaml file contains the user interface markup written in XAML. Copy (Ctrl+C) and paste (Ctrl+V) the following fragment into your application.

Design view (XAML) in Visual Studio while developing the application:

Fig. 1.23. UI design view

MainPage.xaml.cs

The MainPage.xaml.cs file contains the business logic written in C#. Copy (Ctrl+C) and paste (Ctrl+V) the following fragment into your application.

Business logic (C#) view in Visual Studio while developing the application:

Fig. 1.24. Business logic view

Demo

Start the app via Debug > Start Debugging or press F5.

Fig. 1.25. Universal app that computes the sum of two numbers

Last updated