Bug 45277 - On UWP, Entry with IsPassword = true does not allow selection of characters
Summary: On UWP, Entry with IsPassword = true does not allow selection of characters
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.1
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-10-11 14:59 UTC by John Hardman
Modified: 2017-07-14 11:05 UTC (History)
6 users (show)

Tags: UWP Entry IsPassword ac
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description John Hardman 2016-10-11 14:59:20 UTC
Using XF, on UWP, an Entry with IsPassword = true does not allow selection of characters.

Typically a keyboard user might do Ctrl+A, Del to quickly delete contents of an Entry, or Ctrl+Home, Ctrl+Shift+End, Del for the same purpose.

Similarly, a mouse user might just swipe the mouse across with the left-button down to do the same thing.

Neither of these work when IsPassword = true.

Easily reproduced, using:

            Entry userPasswordEntry = new Entry
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.StartAndExpand,
                MinimumHeightRequest = 44,
                MinimumWidthRequest = 44
            userPasswordEntry.IsPassword = true;
Comment 1 Paul DiPietro [MSFT] 2017-01-06 16:28:19 UTC
This actually appears to be intended by design.

Comment 2 John Hardman 2017-01-06 16:45:31 UTC
@Paul DiPietro

The comment in the code is as follows:

// This simulates the "do not allow clipboard copy" behavior the PasswordBox control has

Not allowing clipboard copy is different from not being able to select. The implementation may prevent clipboard copy but it inadvertently prevents select. It should not. Being able to select has use cases other than copying to clipboard.
Comment 3 Paul DiPietro [MSFT] 2017-01-11 19:49:23 UTC
John, I spent some time looking this because the assertion you made is correct although a little complicated. I have no guarantees this will be merged but there's a PR which I believe *mostly* fixes this issue:


The behavior as mentioned was presently allowing no selected text, and the current implementation is tricky because of the way that the FormsTextBox works, in that it has a backing Text property and stays synced with the base.Text property. Simply changing the FormsTextBox code so that the selection is allowed isn't an instant fix by itself, as doing something such as entering "123" into the entry, selecting all of it, and then pressing another character like "a" would result in the text being "1". No good. :)

Ultimately what you'll see in that PR is that the SelectionLength is being cached and OnKeyDown is being a bit abused to check against certain key shortcuts like Ctrl-C/X for copy/cut since the regular PasswordBox doesn't allow it. Now, the changes don't fix the fact that the context menu will still enable one to copy the text, but when that's used it only copies the characters as obfuscation characters (the ● character). 

There are also a couple other existing issues that are noted there as well, so I mostly dealt with the matter at hand of selection. The context menu is an issue that might only be fixable on UWP because RT/8.1 doesn't appear to support the use of Clipboard, but I don't think it's the end of the world if it exists as-is for the time being.
Comment 4 Rui Marinho 2017-03-27 17:34:59 UTC
Should be fixed on 2.3.5-pre1
Comment 5 Jacky Waswani 2017-07-14 11:00:20 UTC
Have verified the bug with latest forms build version

Issue is seems to be fixed with latest build as well.

Screen-cast  : https://www.screencast.com/t/mxEg3ji9

Build Info: https://gist.github.com/GLjackyvaswani/600433ce6f3b92544b42d0392001d326
Comment 6 John Hardman 2017-07-14 11:05:23 UTC
Hi Jacky.

I've noticed a few bug reports where a comment starts "Have verified the bug". This wording suggests confirming the bug exists, not that it is fixed. Could you please use different wording on future bug reports (and ask those around you to do the same), either:

"Confirmed bug exists in version n.n.n.x"


"Tested. Bug appears fixed in version n.n.n.x"

(or similar).