Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

In a WPF app, bullets are not getting displayed in the password box

$
0
0

In our WPF app we have a PasswordBox, which by default, displays bullets for characters typed in it. For a particular user(XP SP3), this was working fine until a month back when he could not enter anything in the password box. In order to find if any changes we had recently made to the product had caused it or was it something entirely different, I created a small app having just a text box and password box and a button. On click of the button, contents of the text box and password box are displayed in a message box.

XAML:

<Grid><Grid.RowDefinitions><RowDefinitionHeight="*"></RowDefinition><RowDefinitionHeight="*"></RowDefinition><RowDefinitionHeight="*"></RowDefinition></Grid.RowDefinitions><Grid.ColumnDefinitions><ColumnDefinitionWidth="*"></ColumnDefinition><ColumnDefinitionWidth="*"></ColumnDefinition></Grid.ColumnDefinitions><TextBlockGrid.Row="0"Grid.Column="0"HorizontalAlignment="Right"VerticalAlignment="Center">User Name:</TextBlock><TextBoxx:Name="usr"Width="120"Height="30"Grid.Row="0"Grid.Column="1"></TextBox><TextBlockGrid.Row="1"Grid.Column="0"HorizontalAlignment="Right"VerticalAlignment="Center">Password:</TextBlock><PasswordBoxx:Name="pass"Width="120"Height="30"Grid.Row="1"Grid.Column="1"></PasswordBox><ButtonHeight="30"Width="60"Grid.Row="2"Grid.ColumnSpan="2"Click="Button_Click">Ok</Button></Grid>

Code behind:

privatevoidButton_Click(object sender,RoutedEventArgs e){MessageBox.Show("Username: "+ usr.Text+", Password: "+pass.Password);}

On running the app, we discovered that the user was actually able

to type in the password, and it was getting displayed correctly on

clicking OK. He was simply not seeing the bullets. I tried changing

the font size and foreground but to no effect. I have the same

configuration on my machine and it works fine for me. At last I

changed the password char to '*' and that is getting displayed fine

on the user's machine. Any help on why the bullets are not getting

displayed?

I tried setting the font for the passowrd box explicityly.

<PasswordBox x:Name="pass" Width="120" Height="30" Grid.Row="1" Grid.Column="1" FontFamily="Times New Roman"></PasswordBox>

But still no success


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>