title | description | ms.topic | ms.date | keywords |
---|---|---|---|---|
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 |
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).
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.
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.
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.
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
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
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.
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.
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.
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).
- 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
- Overview: WinUI 3
- Get started: Create your first WinUI 3 project
- Writing XAML: XAML Platform
- API Reference: WinUI API Reference
- Controls: Controls overview
- Input: Input and interactions
- Motion: Motion for Windows apps
- Accessibility: Usability for Windows apps
- Samples: WinUI 3 Gallery app
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).
- 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
- Overview: WinUI 2
- Get started: Get started with WinUI 2 for UWP
- Writing XAML: XAML Platform
- API Reference: WinUI API Reference
- Controls: Controls overview
- Input: Input and interactions
- Motion: Motion for Windows apps
- Accessibility: Usability for Windows apps
- Samples: WinUI 2 Gallery app
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.
- 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
- Overview: Desktop Guide (WPF .NET)
- Get started: Tutorial: Create a new WPF app
- Writing XAML: XAML Overview (WPF .NET)
- API Reference: .NET API Reference
- Controls: Controls (WPF)
- Input: Input (WPF)
- Motion: Animation overview
- Accessibility: Accessibility best practices
- Samples: WPF Samples GitHub repo
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.
- 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
- Overview: Desktop Guide (Windows Forms .NET)
- Get started: Tutorial: Create a new WinForms app (Windows Forms .NET)
- API Reference: .NET API Reference
- Controls: Overview of using controls (Windows Forms .NET)
- Input: User input (Windows Forms)
- Accessibility: Windows Forms Accessibility
- Samples: Winforms Samples GitHub repo
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: