A password-masked text box is normally not a problem but when I tried to used it in Microsoft Ligthswitch it was a horrific experience. Anyways I got it figured out and here are the steps:
1. Add a Data Item in the Screen and name it Password
2. Drag it to the screen, see the sample screen below:
3. The default control of the Password data type is a Textbox you must change it to a Custom Control -> PasswordBox (Windows Control)
4. Now that the Password control has been painted into your screen, its time to make it functioning by using the following code below:
Private Sub pwdAvailable(sender As Object, e As ControlAvailableEventArgs) AddHandler CType(e.Control, System.Windows.Controls.Control).LostFocus, AddressOf PasswordLostFocus End Sub Private Sub PasswordLostFocus(sender As Object, e As System.Windows.RoutedEventArgs) Me.Password = CType(sender, System.Windows.Controls.PasswordBox).Password End Sub
5. Then add code below in your screen initialize data workspace.
AddHandler Me.FindControl("Password").ControlAvailable, AddressOf pwdAvailable
That’s it, below is the sample screen where I use the password-masked textbox. This is the login screen on my application.