Bewerken

Delen via


User interface and input

This article provides an overview of the Windows UI frameworks that are currently maintained by Microsoft and compares their capabilities.

Microsoft produces both UI frameworks and app platforms. App platforms typically include a UI framework, while UI frameworks are either standalone (not shipped with an app platform) or can be used with multiple app platforms (see Choose your app platform).

The frameworks discussed here include WinUI for both Windows App SDK (WinUI 3) and UWP (WinUI 2), Windows Presentation Foundation (WPF), and Windows Forms (WinForms).

User interface fundamentals

When building a modern Windows app, you have a selection of UI frameworks to choose from. UI frameworks provide your app with built in controls, styles, animations, input handling, and more.

There are five main components that go into creating a user interface for your Windows app. These components are usually built into each UI framework.

  • Controls and styles

    • A control is a UI element that displays content or enables interaction. Controls are the building blocks of the user interface.

      Here's an example of a Button control that's available in UWP, WinUI 2, and WinUI 3. When you place this control into your app, it automatically receives the default design that the UI framework provides.

      WinUI button

    • Styles consist of colors, typography, icons, Fluent materials, and more that can be used throughout your app's design to create a truly unique experience.

      Here's an example of a style component called Acrylic, available in WinUI 2 and WinUI 3. Acrylic is a brush that you can use on surfaces within your app or as the background of your app. It provides a translucent texture.

      Acrylic material

  • Input and interaction

    End users may interact with your app and provide input to your app (such as selection or typing) through different methods. Some examples of input are:

    • Mouse
    • Touch
    • Gamepad
    • Pen
    • Keyboard
    • Surface Dial
    • Touchpad
    • Speech
  • Device support

    End users access Windows apps on a variety of devices, and UI frameworks may only support certain ones. Some common devices for Windows apps to run on are:

    • PCs (often referred to as "desktop", but includes laptops as well)
    • Tablets
    • HoloLens
    • Xbox
    • Surface Hub
  • Motion and animation

    Built-in animations can really give your app a polished look and feel, and provide consistency with first-party apps throughout Windows.

    An example of a built-in animation in UWP, WinUI 2, and WinUI 3 is the animation that occurs when the end user switches between light and dark mode. When the end user switches modes for their entire PC, the app's UI will automatically update as well with a transition animation.

  • Usability and accessibility

    In order to ensure your app is delightful to use for every single user, you must take accessibility into account.

    UI frameworks provide built-in accessibility to controls and styles with purposeful keyboard behavior, screenreader support and more. Many also provide APIs for accessible actions in custom controls, like interacting with screenreaders.

UI frameworks

Each UI framework released by Microsoft has unique capabilities, follows different design languages, and provides different experiences to the end user. This section will compare all the main UI frameworks that you'll be choosing from when you begin to build your app.

The table below shows a brief summary of a few main capabilities between these UI frameworks. For more details on each framework, navigate through the tabs further below.

Capability Windows App SDK (WinUI 3) WinUI 2 for UWP WPF WinForms
Languages supported C#/.NET 6 and later, C++/WinRT C#/.NET Native, C++/WinRT, C++/CX, VB C#/.NET 6 (and later) and .NET Framework, C++/CLI (Managed Extensions for C++), F#, VB C#/.NET 6 (and later) and .NET Framework, C++/CLI (Managed Extensions for C++), F#, VB
Devices supported PCs (incl. laptops and tablets), support for all Windows 10 devices coming soon All Windows 10 devices (PCs, tablets, HoloLens, Xbox, Surface Dial, and more) Desktop PCs and laptops Desktop PCs and laptops
Inputs supported All Windows 10 inputs supported All Windows 10 inputs supported Mouse and keyboard Mouse and keyboard
Windows OS version supported Windows 10 version 1809 or later Windows 10 version 1703 or later Windows XP or later Windows XP or later
WebView support Chromium-based WebView2 Non-chromium WebView WebView2 support coming soon WebView2 support coming soon
Open Source Coming soon Yes Yes (.NET 6 and later only) Yes (.NET 6 and later only)

For more information about each of these UI frameworks, see the information on the following tabs.

Windows App SDK (WinUI 3)

For most new Windows apps, we recommend WinUI with the Windows App SDK (WinUI 3) to build your user interface. WinUI 3 provides consistent, intuitive, and accessible experiences using the latest user interface (UI) patterns.

WinUI 3 is completely decoupled from the Windows OS and ships as a part of the Windows App SDK, which is a set of tools and components that represent the next evolution in the Windows app development platform.

WinUI 3 is the latest generation of WinUI. WinUI 2 and 3 share many of the same controls, styles, and other UI fundamentals (see Comparison of WinUI 2 and WinUI 3).

Key app scenarios enabled by WinUI 3

  • Modern Windows apps that need to run on a variety of modern devices, with a range of modern inputs
  • Desktop/Win32 apps that are written in C++
  • Graphics-heavy apps or games that want to take advantage of DirectX and Win2D
  • Apps with a lot of integrated web content that need high-performance
  • Apps that seek to provide experiences that "fit right in" on the Windows OS and with other first party Windows apps

Helpful documentation for WinUI 3