xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[UWP] Entry ReturnCommand not executed #4877

Closed sude22 closed 5 years ago

sude22 commented 5 years ago

Entry / ReturnCommand is executed when the user press Enter after text input. That still works. But if you paste a text in the Entry with a CR/LF at the end (e.g. a BarcodeScanner), the ReturnCommand is not not executed any more. This used to work. Noticed after updating Windows 10 to 1809.

PureWeen commented 5 years ago

@sude22 if you just try this in a native UWP app do you see the same thing?

Do BarcodeScanners utilize copy/paste to do what they do? Don't they emulate as if they are actually typing into a given field? That's how the one I interfaced with work so maybe they are different?

Or are you saying you could just do CTRL C / Ctrl V and it would register as hitting the Enter key?

sude22 commented 5 years ago

@PureWeen haven't tried in a native UWP app so far. The barcode scanner I'm using is emulating typing, so using Ctrl C/Ctrl V was just a workaround for me, but with the same result.

PureWeen commented 5 years ago

Hmm it seems odd that ctrl c/ ctrl v would send an "Enter Key" KeyDown into a TextBox though

I've attached a repro that's just native UWP and whenever I do a "CTRL V" into the textbox all it registers is "CTRL V" not any of the actual characters

CarriageReturnTextInput.zip

If this is different than previous versions of UWP you'd want to log the issue here and tag UWP https://developercommunity.visualstudio.com

sude22 commented 5 years ago

Well, I don`t know how Xamarin Forms internally handles the input of an UWP Entry, and what internal event is responsible for calling ReturnCommand. But the behavior definitly changed from Win10 1803->1809. That is a problem for me, because when using a barcode scanner the input was automatically completed with the CR/LF at the end, and now the user have to press the enter key...

PureWeen commented 5 years ago

@sude22 so I have a VM running 1803 and it's acting the same there. I feel like the problem might be with the barcode scanner drivers acting differently between windows builds and I would recommend bringing the issue up with them first to get their thoughts.

I don`t know how Xamarin Forms internally handles the input of an UWP Entry

We don't really do anything special. It's just a UWP TextBox control. We don't intercept characters coming in and then reinterpret them. The only Virtual Keys that get fired with the KeyDown event is the hitting of CTRL V

If you have a reproduction that I can run on 1803 with a set of steps to see the CTRL C/CTRL V behavior that works on 1803 and not 1809 can you please attach it to this issue and then I will reopen?

Since it's not a physical enter key being hit then our code doesn't process it as such

samhouts commented 5 years ago

@sude22 Since we haven't heard from you in more than 30 days, we hope this issue is no longer affecting you. If it is, please reopen this issue and provide the requested information so that we can look into it further. Thank you!