Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn WinUI 3.0

You're reading from   Learn WinUI 3.0 Leverage the power of WinUI, the future of native Windows application development

Arrow left icon
Product type Paperback
Published in Mar 2021
Publisher Packt
ISBN-13 9781800208667
Length 440 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Alvin Ashcraft Alvin Ashcraft
Author Profile Icon Alvin Ashcraft
Alvin Ashcraft
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface 1. Section 1: Introduction to WinUI and Windows Applications
2. Chapter 1: Introduction to WinUI FREE CHAPTER 3. Chapter 2: Configuring the Development Environment and Creating the Project 4. Chapter 3: MVVM for Maintainability and Testability 5. Chapter 4: Advanced MVVM Concepts 6. Chapter 5: Exploring WinUI Controls 7. Chapter 6: Leveraging Data and Services 8. Section 2: Extending WinUI and Modernizing Applications
9. Chapter 7: Fluent Design System for Windows Applications 10. Chapter 8: Building WinUI Apps with .NET 5 11. Chapter 9: Enhancing Applications with the Windows Community Toolkit 12. Chapter 10: Modernizing Existing Win32 Applications with XAML Islands 13. Section 3: Build and Deploy on Windows and Beyond
14. Chapter 11: Debugging WinUI Applications with Visual Studio 15. Chapter 12: Hosting an ASP.NET Core Blazor Application in WinUI 16. Chapter 13: Building, Releasing, and Monitoring Applications with Visual Studio App Center 17. Chapter 14: Packaging and Deploying WinUI Applications 18. Assessments 19. Other Books You May Enjoy

WinUI compared to other Windows development frameworks

Where does WinUI fit in the overall landscape of Microsoft's Windows development frameworks? Let's draw some comparisons to help answer that question, starting with those that are most similar to WinUI.

WinUI versus UWP

This is a tricky comparison because most WinUI apps today are UWP apps at their core. In fact, WinUI 2.x are controls for UWP applications. When considering WinUI 3.0, think of WinUI as the UI framework and UWP as the application platform layer. They share the same XAML schema, base visuals, and underlying Windows APIs. Any UWP app that has the same minimum and target versions of Windows specified can add the WinUI 2.x libraries to leverage the new and updated features.

A key difference between apps that use WinUI versus traditional UWP apps is access to new and updated controls and other visual elements without requiring an updated Windows SDK. This enables developers to bring apps with the same look and features to more users across multiple versions of Windows 10. This differentiator makes for happier developers and users.

WinUI versus WPF

WinUI and WPF have many similarities. Both are application frameworks, and both types of apps rely on XAML to define UI elements. This means that they both offer the same separation of UI and business logic when implementing the MVVM pattern. WPF XAML has the same concepts of styles, resources, data binding, and adaptiveness of the UI layout.

WinUI advantages

A significant performance advantage of WinUI—and UWP apps in general—is the availability of compiled bindings. We will discuss compiled bindings in more detail later. For now, just know that using them offers a performance boost over traditional data binding in both UWP and WPF. Compiled bindings are identified by the use of the x:Bind syntax in XAML, rather than Binding.

Another advantage of WinUI over WPF is that it is more secure by default. Sandboxed access to users' filesystems and devices can give users a sense of ease, knowing that malicious behavior has limits to which hardware and data it can access. WPF apps' access is only limited by the configuration of Windows User Account Control (UAC) on the PC.

WPF advantages

The primary advantage of WPF applications is the fact that they are not directly tied to minimum versions of Windows 10. WPF apps target a .NET Framework or .NET Core version. Any version of Windows that supports the target .NET version can run that WPF app. This significantly increases the potential user base of WPF apps. In fact, WPF apps can be deployed and run on Windows 7, something not possible with UWP or WinUI.

Note

There is a project called Uno Platform that enables WinUI XAML to run on iOS and Android, leveraging Xamarin and on the web with WebAssembly. These WinUI web apps can run in the browser on previous versions of Windows, including Windows 7. The Uno Platform goal and tagline is WinUI Everywhere.

Learn more about Uno Platform at https://platform.uno/.

Learn more about WebAssembly at https://webassembly.org/.

The secure-by-default nature of WinUI apps provides WPF apps with a greater degree of flexibility and power. Many types of applications will require full access to the Windows filesystem or to particular devices and drivers—for example, it would be much easier to create a custom file manager application with complete access to a computer's filesystem. While WinUI apps can now request this access in newer versions of Windows 10, this is available by default in any version with WPF.

A new WPF advantage emerged with the releases of .NET Core 3.x and .NET 5. .NET developers can now create WPF apps with .NET Core, bringing performance and deployment advantages of .NET Core to WPF developers. For instance, applications targeting difference versions of .NET Core can be deployed side by side on a machine without creating version conflicts.

The difference in deployment models can be debated as to which framework has an advantage. The easiest way to deploy a WinUI app is through the Windows Store. The easiest way to deploy a WPF app with .NET Framework is via an installer package. WPF apps can be deployed through the Store through Windows Containers, and WinUI apps can be deployed without the Store with MSIX installers. WinUI deployment will be covered in detail in Chapter 12, Build, Release, and Monitor Apps with Visual Studio App Center and Chapter 13, Packaging and Deployment Options and the Windows Store.

WinUI versus Windows Forms (WinForms)

WinForms is a .NET UI framework that was introduced with .NET Framework 1.0. Developers can easily create a WinForms UI with the visual design surface in Visual Studio, which generates C# or VB code that creates the UI at runtime. Most of the advantages and disadvantages of WPF also apply to WinForms: security, deployment, and .NET Core—WinForms apps can also be created with .NET Core 3 and later.

WinUI advantages

Similarities between WinUI and WPF are their primary advantages over WinForms: data binding, adaptive layout, and a flexible styling model. These advantages all stem from the use of XAML for UI layout. Another advantage of XAML is offloading render processing from the central processing unit (CPU) to the graphics processing unit (GPU). WinUI controls inherit the Windows 10 styles by default and have a more modern appearance than WinForms controls. WinUI applications also handle dots per inch (DPI) scaling and touch input well. The WinForms UI framework matured before touch input and DPI scaling were a concern for Windows developers.

A primary advantage of WinUI over WPF also applies to WinForms: security by default.

WinForms advantages

In addition to the advantages that WinForms shares with WPF over WinUI—greater access to Windows, .NET Core apps, and Windows compatibility—WinForms also has a well- deserved reputation for rapid UI development. If you need to create a simple Windows application in a minimal amount of time, the drag-and-drop WinForms designer is easy and intuitive. Many experienced Windows developers still default to WinForms when tasked with creating a simple utility or UI test harness for a .NET library.

You have been reading a chapter from
Learn WinUI 3.0
Published in: Mar 2021
Publisher: Packt
ISBN-13: 9781800208667
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £16.99/month. Cancel anytime