Modernizing Your Windows Applications with the Windows App SDK and WinUI
eBook - ePub

Modernizing Your Windows Applications with the Windows App SDK and WinUI

Matteo Pagani, Marc Plogas

Share book
  1. 514 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Modernizing Your Windows Applications with the Windows App SDK and WinUI

Matteo Pagani, Marc Plogas

Book details
Book preview
Table of contents
Citations

About This Book

Use Windows App SDK and WinUI 3 to take your existing Windows desktop applications to the next level by enabling a modern and accessible UI and integrating the latest Windows features like WinML and Windows HelloKey Features• Improve your apps and enable them to support modern devices with features such as touch screens and responsive UI• Integrate your app with the latest Windows innovations using modern tools and the newest C# features• Reuse your existing knowledge in.NET, C#, and Visual Studio to create new Windows appsBook DescriptionIf you're a developer looking to improve and modernize your existing LOB applications to leverage modern Windows features without having to rewrite the entire application from scratch, this book is for you. You'll learn how to modernize your existing Windows Forms, WPF, and UWP applications and enrich them with the latest Windows features.Starting with sample LOB applications that cover common scenarios, you'll learn the differences between various components and then focus on design features for improved visual aspects like accessibility and responsive layouts.The book shows you how to enhance your existing applications using Windows App SDK components and various Windows APIs, resulting in deeper integration with the operating system. You'll be taking a closer look at WinML, which enables Windows applications to evaluate machine learning models offline and leverage the power of your machine, or notifications, to engage with your users in a more effective way. You'll also learn how to make your application deployment-ready by distributing it using various platforms like the Microsoft Store or websites.By the end of this Windows book, you'll be able to create a migration plan for your existing Windows applications and put your knowledge to work by enhancing your application with new features and integrating them with the Windows ecosystem.What you will learn• Understand the key concepts of the Windows App SDK and WinUI• Integrate new features by creating new applications or by enhancing your existing ones• Revamp your app's UI by adopting Fluent Design and new interaction paradigms such as touch and inking• Use notifications to engage with your users more effectively• Integrate your app with the Windows ecosystem using the Windows App SDK• Use WinML to boost your tasks using artificial intelligence• Deploy your application in LOB and customer-facing scenarios with MSIXWho this book is forThis book is for developers who are building Windows applications with Windows Forms, WPF, and UWP and would like to evolve and modernize their applications, but aren't able to rebuild them from scratch. This book focuses on Line-of-Business scenarios. Basic knowledge of Windows app development, .NET/C#, and Visual Studio will help you understand the concepts covered in this book.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Modernizing Your Windows Applications with the Windows App SDK and WinUI an online PDF/ePUB?
Yes, you can access Modernizing Your Windows Applications with the Windows App SDK and WinUI by Matteo Pagani, Marc Plogas in PDF and/or ePUB format, as well as other popular books in Ciencia de la computación & Programación de Microsoft. We have over one million books available in our catalogue for you to explore.

Information

Year
2022
ISBN
9781803247779

Section 1: Basic Concepts

Section 1 will set the stage for working with the Windows App SDK and WinUI. The chapters will guide developers in understanding the current state of Windows app development, how to start a new project, and the key concepts to know, regardless of the starting technology.
This section contains the following chapter:
  • Chapter 1, Getting Started with the Windows App SDK and WinUI

Chapter 1: Getting Started with the Windows App SDK and WinUI

Windows desktop applications have always played a critical role in the enterprise and productivity space. No matter what you do in your day-to-day job, if you are using a computer in a professional capacity, you are using one or more desktop applications to get your job done – Visual Studio, Office, and Photoshop are just a few of the most famous examples. And let's not forget many of the line-of-business applications that we might use in our everyday jobs to perform tasks such as submitting expense reports or creating financial reports.
Web and mobile devices have certainly changed the ecosystem, and many of these tasks can be performed everywhere nowadays. But this doesn't mean that desktop applications aren't relevant anymore. They still play a critical role in our productivity, thanks to better performance, which makes them the best choice for heavy tasks such as video rendering or graphic design. They are optimized for mouse and keyboard, which is still the primary input method for scenarios such as coding, data entry, and data analysis. They can be deeply integrated with every type of external hardware, such as barcode readers, scanners, and blood sample testers.
For all these reasons, Microsoft continues to heavily invest in the Windows desktop space to provide developers the best platform and tools to create powerful experiences for their customers. And with the release of Windows 11, there's a renewed interest among developers to delight their users with applications that take advantage of the latest innovations in the platform.
In this chapter, we're going to explore the following topics:
  • What the Windows App SDK is and how it compares to the other existing development platforms for Windows
  • The role of the new .NET runtime
  • Choosing the right deployment model for your application
  • Creating your first Windows App SDK project
  • Managing the relationship between the Windows App SDK and Windows
  • Building libraries and components
These topics will set the stage for you to get started with the Windows App SDK and WinUI (the short name for Windows UI Library), which will be useful for the next chapters.

Technical requirements

To build applications with the Windows App SDK, you will need the following:
  • A computer with the latest version of Windows 10 or Windows 11.
  • Visual Studio 2022 with the following workloads:
  • Universal Windows Platform (UWP) development
    • .NET desktop development
    • Desktop development with C++
  • The Windows SDK version 2004 (build 19041) or later. This SDK will be installed with Visual Studio when you enable the UWP development workload.
  • The .NET 6 SDK. This SDK will be installed together with Visual Studio when you enable the .NET Framework desktop development workload.
  • The Visual Studio extension for the Windows App SDK (if you are using Visual Studio 2022 Update 1 or later, it will already be included).
The code for the chapter can be found at the following URL:
https://github.com/PacktPublishing/Modernizing-Your-Windows-Applications-with-the-Windows-Apps-SDK-and-WinUI/tree/main/Chapter01

A brief history of Windows UI platforms

Over the years, UI guidelines and paradigms have constantly shifted as hardware and platforms evolved. We moved from screens with 640 x 480 resolution to 4K or even 8K screens, from mouse and keyboard only to touch and digital pens. Consequently, Microsoft has created multiple UI platforms over time, with the goal of offering developers the opportunity to build modern applications; each of them represented the state of the art for the time when they were released.
The first platform was called Microsoft Foundation Class Library (MFC), which was a C++ object-oriented UI library released by Microsoft in 1992. It was a wrapper around most of the Win32 and Component Object Model (COM) APIs. Thanks to MFC, developers were able to build UIs with the most common Windows controls and build complex interfaces made up of multiple windows, panels, and so on. MFC was a considerable success, and it's still heavily used today by many developers. The following screenshot shows the look and feel of a typical MFC application:
Figure 1.1 – A Windows application that uses MFC as a UI framework
Figure 1.1 – A Windows application that uses MFC as a UI framework
However, as years passed by, it started to show limitations in supporting modern devices and features such as high-resolution screens and touch inputs. Additionally, it can be used only by C++ developers, while many developers over time have migrated to managed languages such as C#, which are easier to learn and support.
In 2002, Microsoft released the first version of .NET Framework with the goal of improving developer productivity. By running applications inside a virtual environment called Common Language Runtime (CLR), developers could get out-of-the-box features such as security, memory, and exception handling that, in the past, needed to be manually managed. Additionally, by introducing languages such as C# and VB.NET, Microsoft reduced the learning curve required to master a programming language and start building software. As part of .NET Framework, Microsoft included a platform to build Windows desktop applications called Windows Forms. It's an event-driven platform, which makes it easier to build complex applications by wrapping the existing Windows UI common controls and Windows APIs in managed code. The development experience is mostly UI-based – developers create UIs with a visual designer by dragging and dropping the available controls inside a window. Then, they can write code that reacts to the events exposed by the various controls, such as the click of a button or the selection of an item from a list. The following screenshot shows the development experience provided by Visual Studio to build Windows Forms applications:
 Figure 1.2 – The Windows Forms designer in Visual Studio
Figure 1.2 – The Windows Forms designer in Visual Studio
The platform kept evolving across the various releases of .NET Framework, until it reached full maturity with version 2.0.
With the release of .NET Core 3.0, Windows Forms has been integrated into the modern .NET development stack for the first time. This choice has enabled developers to access all the latest enhancements in the platform, such as newer versions of the C# language, performance improvements, or the latest Windows APIs. However, when it comes to building the UI, it still lacks many of the features you would expect from a modern platform, such as support for responsive layouts and new input experiences.
In 2006, as part of the release of .NET Framework 3.0, Microsoft unveiled Windows Presentation Foundation (WPF), the next evolution of the Microsoft UI platform. WPF introduced, for the first time, features that are still used today by modern UI platforms (including the Windows App SDK), such as XAML (which stands for Extensible Application Markup Language), binding, and dependency properties. WPF still supports building the UI with a designer, but it isn't as essential as it was for Windows Forms. WPF, in fact, decouples the UI from the business logic by describing the UI with XAML, an XML-based language. Additionally, WPF added support for features such as 2D/3D rendering, hardware acceleration, animations, and vector graphics. As with Windows Forms, .NET Core 3.0 welcomed WPF as a first-class citizen in...

Table of contents