Learn WinUI 3.0
eBook - ePub

Learn WinUI 3.0

Leverage the power of WinUI, the future of native Windows application development

Alvin Ashcraft

Compartir libro
  1. 440 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

Learn WinUI 3.0

Leverage the power of WinUI, the future of native Windows application development

Alvin Ashcraft

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

A beginner's guide to building Windows applications with WinUI for UWP and desktop applications

Key Features

  • Create modern Windows 10 applications and gain access to UI controls that were previously limited to UWP applications
  • Discover how to modernize your existing Win32 apps with a modern Windows 10 UI
  • Learn to embed a single page application (SPA) in a WinUI application with a web framework like Blazor

Book Description

WinUI 3.0 takes a whole new approach to delivering Windows UI components and controls, and is able to deliver the same features on more than one version of Windows 10. Learn WinUI 3.0 is a comprehensive introduction to WinUI and Windows apps for anyone who is new to WinUI, Universal Windows Platform (UWP), and XAML applications.

The book begins by helping you get to grips with the latest features in WinUI and shows you how XAML is used in UI development. You'll then set up a new Visual Studio environment and learn how to create a new UWP project. Next, you'll find out how to incorporate the Model-View-ViewModel (MVVM) pattern in a WinUI project and develop unit tests for ViewModel commands. Moving on, you'll cover the Windows Template Studio (WTS) new project wizard and WinUI libraries in a step-by-step way. As you advance, you'll discover how to leverage the Fluent Design system to create beautiful WinUI applications. You'll also explore the contents and capabilities of the Windows Community Toolkit and learn to create a new UWP user control. Toward the end, the book will teach you how to build, debug, unit test, deploy, and monitor apps in production.

By the end of this book, you'll have learned how to build WinUI applications from scratch and modernize existing WPF and WinForms applications using WinUI controls.

What you will learn

  • Get up and running with WinUI and discover how it fits into the landscape of Project Reunion and Windows UI development
  • Build new Windows apps quickly with robust templates
  • Develop testable and maintainable apps using the MVVM pattern
  • Modernize WPF and WinForms applications with WinUI and XAML Islands
  • Discover how to build apps that can target Windows and leverage the power of the web
  • Install the XAML Controls Gallery sample app and explore available WinUI controls

Who this book is for

This book is for anyone who wants to develop Windows applications with a modern user experience (UX). If you are familiar with UWP and WPF and are looking to enhance your knowledge of Windows development and modernize existing apps, you will find this book useful. Hands-on experience with C# and.NET is expected but no prior knowledge of WinUI is required.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Learn WinUI 3.0 un PDF/ePUB en línea?
Sí, puedes acceder a Learn WinUI 3.0 de Alvin Ashcraft en formato PDF o ePUB, así como a otros libros populares de Computer Science y Programming in C#. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2021
ISBN
9781800207394
Edición
1

Section 1: Introduction to WinUI and Windows Applications

WinUI 3.0 is Microsoft’s new UI framework for Windows developers. This section will start by exploring the recent history of XAML and Windows UI frameworks and introduce readers to WinUI. Throughout the chapters of this section, you will learn about WinUI concepts by building a simple project from scratch, adding controls and features by following design patterns and best practices. These patterns and practices include the Model-View-ViewModel (MVVM) design pattern, unit testing WinUI projects, and using dependency injection (DI) to inject service dependencies into the application components.
This section includes the following chapters:
  • Chapter 1, Introduction to WinUI
  • Chapter 2, Configuring the Development Environment and Creating the Project
  • Chapter 3, MVVM for Maintainability and Testability
  • Chapter 4, Advanced MVVM Concepts
  • Chapter 5, Exploring WinUI Controls
  • Chapter 6, Leveraging Data and Services

Chapter 1: Introduction to WinUI

WinUI is a set of open source controls and libraries that Windows developers can leverage in their Universal Windows Platform (UWP) and Win32 applications. UWP developers use the Windows software development kit (SDK) to build their applications and are required to select a target SDK version in a project's properties. By extracting the UWP controls and user interface (UI) components from the Windows SDK and releasing them as a set of open source libraries under the name WinUI, Microsoft is able to release versions at a faster cadence than Windows itself (as Windows SDK versions are linked to those of Windows). This separation also enables the controls to be used on older versions of Windows 10. While building UWP and Win32 applications with WinUI is the current recommendation, it is important to learn where WinUI and UWP fit in the larger Windows development landscape.
In this book, you will learn how to build applications for Windows with the WinUI 3.0 libraries. Throughout the course of the book, we will build a real-world application using recommended patterns and practices for Windows application development.
Before we start building our WinUI app, it's important to have a good foundation in Windows client development, the different types of Extensible Application Markup Language (XAML) UI markup, and how WinUI compares to other Windows desktop development frameworks. Therefore, in this first chapter, you will start by learning some background on UWP and WinUI.
In this chapter, we will learn about the following topics:
  • What UWP is and why Microsoft created yet another application framework
  • How XAML can be leveraged to create great UIs on many device sizes and families
  • Why WinUI was created and how it relates to UWP
  • Where WinUI fits in the Windows developer landscape
  • What WinUI 3.0 brings to the table
Don't worry! It won't take very long to cover the background stuff, and it will help provide some context as you start building your WinUI app. In the next chapter, you will get your hands on some code when you create your first WinUI project.

Technical requirements

To follow along with the examples in this chapter, the following software is required:
  • Windows 10 version 1803 or newer. You can find your version of Windows in Settings | About.
  • Visual Studio 2019 version 16.9 or newer with the following workloads: .NET Desktop Development and UWP Development.
  • WinUI 3.0 project templates—at the time of this writing, the templates can be downloaded from Visual Studio Marketplace at https://marketplace.visualstudio.com/items?itemName=Microsoft-WinUI.WinUIProjectTemplates. After WinUI 3.0 is released, the templates will likely be included with Visual Studio.
The source code for this chapter is available on GitHub at this URL: https://github.com/PacktPublishing/-Learn-WinUI-3.0/tree/master/Chapter01.
Note
The WinUI 3.0 site on Microsoft Docs has up-to-date guidance on setting up a developer workstation for WinUI development: https://docs.microsoft.com/en-us/uwp/toolkits/winui3/.

Before UWP – Windows 8 XAML applications

Before UWP applications were launched with Windows 10 in 2015, there were XAML applications for Windows 8 and 8.1. The XAML syntax and many of the application programming interfaces (APIs) were the same, and they were Microsoft's next step in an attempt to achieve universal app development across desktop, mobile, and other platforms (Xbox, mixed reality, and so on). A XAML app could be written for Windows 8 and Windows Phone. These projects would generate separate sets of binaries that could be installed on a PC or a Windows Phone.
These apps had many other limitations that modern UWP apps do not. For instance, they only ran fullscreen, as shown in the following screenshot:
Figure 1.1 – Windows 8 fullscreen app (sourced from Stack Overflow; reproduced under CC BY-SA 4.0 – https://creativecommons.org/licenses/by-sa/4.0/)
Figure 1.1 – Windows 8 fullscreen app (sourced from Stack Overflow; reproduced under CC BY-SA 4.0 – https://creativecommons.org/licenses/by-sa/4.0/)
Many other early restrictions on Windows 8 apps have been lessened or completely removed in UWP app development. Figure 1.2, which follows, documents these changes:
Figure 1.2 – Windows 8 and Windows 10 app comparison table
Figure 1.2 – Windows 8 and Windows 10 app comparison table

Windows application UI desig...

Índice