Skip to content

Latest commit

 

History

History
238 lines (157 loc) · 14.8 KB

user-interface.md

File metadata and controls

238 lines (157 loc) · 14.8 KB
titledescriptionms.topicms.datekeywords
User interface and input
This article provides an index of development features that are related to creating user interfaces for Windows apps.
article
09/02/2022

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.

CapabilityWindows App SDK (WinUI 3)WinUI 2 for UWPWPFWinForms
Languages supportedC#/.NET 6 and later, C++/WinRTC#/.NET Native, C++/WinRT, C++/CX, VBC#/.NET 6 (and later) and .NET Framework, C++/CLI (Managed Extensions for C++), F#, VBC#/.NET 6 (and later) and .NET Framework, C++/CLI (Managed Extensions for C++), F#, VB
Devices supportedPCs (incl. laptops and tablets), support for all Windows 10 devices coming soonAll Windows 10 devices (PCs, tablets, HoloLens, Xbox, Surface Dial, and more)Desktop PCs and laptopsDesktop PCs and laptops
Inputs supportedAll Windows 10 inputs supportedAll Windows 10 inputs supportedMouse and keyboardMouse and keyboard
Windows OS version supportedWindows 10 version 1809 or laterWindows 10 version 1703 or laterWindows XP or laterWindows XP or later
WebView supportChromium-based WebView2Non-chromium WebViewWebView2 support coming soonWebView2 support coming soon
Open SourceComing soonYesYes (.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

WinUI 2 for UWP

For most UWP apps, we recommend using WinUI 2 to build your user interface. WinUI 2 is a standalone UI framework that ships in a NuGet package and can easily be added to any UWP app to modernize the design and overall experience.

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 2

  • UWP apps that are looking to work downlevel to all versions of Windows 10 and Windows 11
  • Graphic-heavy apps or games that want to take advantage of DirectX and Win2D
  • UWP apps that need to run on a variety of modern devices, with a range of modern inputs
  • 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 2

WPF

The Windows Presentation Framework (WPF) is an app model for building desktop apps with .NET 6 (and later) or .NET framework. It's an open source platform that is maintained by both the Windows and .NET teams.

The UI framework that ships within WPF provides controls, styles, and capabilities that are supported downlevel through Windows XP.

Key app scenarios enabled by WPF

  • Apps that need to run downlevel to versions of Windows preceding Windows 10
  • Apps that solely run on PCs, and don't require a variety of inputs such as touch
  • Apps that are in need of more complex, built in controls: WPF has the largest set of built-in controls available for Windows development

Helpful documentation for WPF

Windows Forms

Windows Forms provides a unique built-in Visual Studio Designer for building desktop .NET apps. With the Designer, you build your user interface by dragging and dropping the built-in controls directly onto your app's UI.

Windows Forms is an open source project.

Note that Windows Forms does not have animations built in, unlike the other UI frameworks mentioned in this article. It also does not support XAML markup - you must use either the Designer or code to create your app's UI.

Key app scenarios enabled by Windows Forms

  • Developers or designers who want to build apps without knowing or writing XAML
  • Apps that need to run downlevel to versions of Windows preceding Windows 10
  • Apps that solely run on PCs, and don't require a variety of inputs such as touch
  • Apps that aren't seeking to create custom controls or highly custom UI

Helpful documentation for Windows Forms

Other

There are a few UI frameworks that haven't been discussed in this article, including Win32/ComCtl32 and MFC. While these UI frameworks are still available for use, they are not regularly maintained and don't meet the same accessibility and design standards that Windows provides today. It's recommended that you use a more modern framework when creating new Windows apps.

If you'd like to learn about modernizing an app that's using an older UI framework, see Modernize your desktop apps.

For more information on these UI frameworks, see the following documentation:


close