Edit

Input and interactions

WinUI apps automatically handle a wide variety of inputs and run on a variety of devices—there's nothing extra you need to do to enable touch input, for example. But there are times when you might want to optimize your app for certain types of input or devices. For example, if you're creating a painting app, you might want to customize the way you handle pen input.

The design and coding instructions in this section help you customize your WinUI app for specific types of inputs.

Using Windows Runtime input APIs in WinUI 3 desktop apps

WinUI 3 desktop apps can use most Windows Runtime (WinRT) APIs directly, including many input-related APIs from the Windows.Devices.Input, Windows.Gaming.Input, and Windows.UI.Input namespaces. You don't need to build a UWP app to access these capabilities.

There are a few things to be aware of:

  • Works in any WinUI 3 app — Pointer properties (pressure, tilt, barrel button), device detection, gamepad hardware access (Windows.Gaming.Input), and touch/mouse input all work with no special configuration.
  • Requires package identity (MSIX) — Some APIs, such as SpeechRecognizer and SpeechSynthesizer, require your app to have package identity. The default WinUI 3 project template uses MSIX packaging, so this requirement is met automatically for most apps.
  • UWP-only — APIs that depend on ApplicationView, CoreWindow, or the GetForCurrentView pattern aren't available in desktop apps. This includes gaze tracking (GazeInputSourcePreview) and input injection (InputInjector). For these features, the UWP reference documentation remains the best resource.

For the complete list of supported and unsupported WinRT APIs in desktop apps, see Windows Runtime APIs supported in desktop apps.

Tip

Topics in this section that link to UWP documentation cover features that use UWP-only APIs. You can still reference these topics for design guidance and concepts, even though the APIs aren't directly available in WinUI 3 desktop apps.

Get started

Topic Description
Input primer Familiarize yourself with each input device type and its behaviors, capabilities, and limitations when paired with certain form factors.
Gaze input Track a user's gaze based on the location and movement of their eyes and head. Gaze APIs require UWP; see the linked UWP reference.

Input devices

Topic Description
Identify input devices Identify the input devices connected to a Windows app device and identify their capabilities and attributes.
Pointer Receive, process, and manage input data from pointing devices such as touch, mouse, pen/stylus, and touchpad.
Pen and Windows Ink Handle pen-specific input properties such as pressure, tilt, barrel button, and eraser detection.
Touch Handle touch input, enabling immersive experiences that your users can explore with confidence.
Mouse Handle mouse input in your app, including button clicks, scroll wheel, and pointer movement.
Keyboard Handle keyboard input, an essential part of the interaction experience and indispensable for accessibility.
Gamepad and remote control Design for Xbox gamepad and remote control input. See the linked UWP reference for 10-foot design patterns.
Touchpad Handle touchpad input, which combines indirect multi-touch input with the precision of a pointing device.
Multiple inputs Design your app to work with as many input types as possible to maximize flexibility, usability, and accessibility.
Custom text input Use the core text APIs to receive text input from any text service supported on Windows devices, in any language and from any input type.

Interactions

Topic Description
Drag and drop Enable drag and drop interactions in your app.
Panning Guidelines for implementing panning interactions.
Rotation Guidelines for implementing rotation interactions.
Selecting text and images Guidelines for selecting and manipulating text, images, and controls.
Targeting Guidelines for touch targeting and visual feedback.
Visual feedback Provide visual feedback to users during interactions.
Optical zoom and resizing Guidelines for zooming and resizing elements.

Speech and feedback

Topic Description
Speech Integrate speech recognition and text-to-speech directly into the user experience of your app. Requires package identity.
Haptics Add touch feedback to reinforce user input and create more responsive, intuitive interactions.