Windows – Intro into windows platform and Universal Windows Platform (UWP).

Today I start learning UWP named Universal Windows Platform and this is the subject of this short intro tutorial.
In the past, I used the old Windows Forms and the new Universal Windows Platform (UWP) has a very similar operation to build the forms.
About the Windows Presentation Foundation (WPF) is a UI framework that creates desktop client applications that supports a broad set of application development features, including an application model, resources, controls, graphics, layout, data binding, documents, and security.
Both Windows Forms and WPF are old, and Microsoft is pointing developers towards its Universal Windows Platform (UWP) instead.
Windows Forms (.NET) is the framework for Windows desktop applications that were introduced at the same time as .NET itself in 2002.
Windows Presentation Foundation is a GUI framework for .NET and was introduced with .NET Framework 3.0 in 2006, part of the Vista wave of technology.
The new one is the Universal Windows Platform (UWP) and provides a common type system, APIs, and application model for all devices that run Windows 10.
There are also other options for the desktop, such as Power Apps, Xamarin Forms if you still want to use .NET or Electron but these options is not the subject of this tutorial.
Let’s start with a good tutorial created by Microsoft, see this webpage, where you can find a video tutorial pretty similar to this tutorial.
If you using the Visual Studio 2019 then you need to use these steps:
Create a new projectWindows TempateStudio (Universal Windows) and use the Next button.
The next window wizard dialog will let you set all settings for your project, like Project name, Location – on disk, and Solution name – the name of the application.
Press the button Create and the Visual Studio I.D.E. will open.
Click on MainPage.xaml and you’ll see open in the left area with the design of the Universal Windows Platform (UWP) window form.
You can add buttons and graphics elements from Toolbox, like an old-style Windows Form.
This file has a new structured format like this:

The access to each element can be done using the Properties area from the right where you can find all of these properties.
The file named MainPage.xaml.cs will link the C# source code from this form design.
For example, if you add a button to the form and you want to use the click option, then into Properties area click on the lightning icon and you can edit all events.
Search the Click area and use double-click on the edit box.
You will see the edit box is filled with this text: Button_Click and into the MainPage.xaml.cs is added a new source code:

Now you can add source code to link the click event Button.
I used the video tutorial from Microsoft and I make my changes to get the color value.
I added a new edit box and I named textBox2.
With a simple conversion, I was able to get the HEX value for each color.
Let’s see the source code:

The result is this:

Very simple to use it.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.