question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Touch Input Issues

See original GitHub issue

Describe the bug

Since upgrading to Preview 3, WinUI 3 apps seem to be missing some touch functionality.

  • Soft keyboard does not appear when tapping on text boxes. I’ve tried putting break points in the FocusEngaged and Tapped events but these are not triggered
  • Long presses do not seem to register as right clicks. This means no context menus or even the visual feedback that a right click has occurred

Steps to reproduce the bug

Soft keyboard:

  1. Create a new application with the [Experimental] Blank App, Packaged with WAP (WinUI 3 in Desktop)
  2. Remove existing Windows App SDK nuget packages
  3. Install Microsoft.WindowsAppSDK 1.0.0-preview3
  4. Add a textbox to the MainWindow
  5. Deploy on a touch device
  6. Try to enter text using soft keyboard

Long press: 7) Add a ContextFlyout to a control on the MainWindow 8) Deploy on a touch device 9) Long press on control with ContextFlyout attached

Expected behavior

Soft keyboard should appear, allowing user to enter text

ContextFlyout should appear on long press

Screenshots

No response

IDE

Visual Studio 2019

NuGet package version

Microsoft.WindowsAppSDK 1.0.0-preview3

Project type

  • Packaged

Windows version

May 2021 Update (19043)

Additional context

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:8
  • Comments:61 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
gabbybilkacommented, Apr 18, 2022

As an update, we are publishing a fix as part of 1.0.3 that addresses focus issues with touch caused by PreviewKeyDown and PreviewKeyUp events not firing (task.ms/38714191) @krschau).

However, the fix for the soft keyboard not appearing in TextBox is targeting 1.0.4 (task.ms/38831898 @bkudiess).

4reactions
brentafiscommented, Nov 11, 2022

@brentafis: can you provide a small example for your workaround?

Thank you

Using Visual Studio 2022 => New Project => Blank App, Packaged (WinUI3 in Desktop)

MainWindow.xaml

<Window
    x:Class="App4.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App4"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
        <TextBox
            GotFocus="OnTextBoxGotFocus"
            Width="200"/>
    </StackPanel>
</Window>

MainWindow.xaml.cs

using Microsoft.UI.Xaml;
using WinRT.Interop;

namespace App4
{
    public sealed partial class MainWindow : Window
    {
        public MainWindow()
        {
            this.InitializeComponent();
        }

        private void OnTextBoxGotFocus(object sender, RoutedEventArgs e)
        {
            Windows.UI.ViewManagement.InputPane inputPane = Windows.UI.ViewManagement.InputPaneInterop.GetForWindow(WindowNative.GetWindowHandle(this));
            inputPane.TryShow();
        }
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why Is My Touch Screen Not Working? 11 Steps to Fix It
Restart the device Clean the touch screen and screen protector Dry off your smartphone Gently tap each corner of the phone Remove the...
Read more >
11 Ways to Fix Touch Screen Not Working on Android | 2023
1. Restart Android Phone/Tablet ... The first step to perform when your touch screen is not working is to restart your device. This...
Read more >
Android Touchscreen Not Working? 7 Tips, Fixes, and ...
Restarting your phone shuts down and refreshes all background services, which could have crashed and led to your issue. Press and hold the...
Read more >
Fix a screen that isn't working right on Android
Step 2: Try these troubleshooting steps · Touch the top left corner of the screen. · Slowly drag your finger to the bottom...
Read more >
Android Touch Screen Not Working? How to Deal with This ...
Android touch screen not working issue may be caused by faulty Android SD card or SIM card sometimes. In this situation, you can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found