2

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>
        <RowDefinition Height="*"></RowDefinition>
        <RowDefinition Height="*"></RowDefinition>
        <RowDefinition Height="*"></RowDefinition>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"></ColumnDefinition>
        <ColumnDefinition Width="*"></ColumnDefinition>
    </Grid.ColumnDefinitions>
    <TextBlock Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center">User Name:</TextBlock>
    <TextBox x:Name="usr" Width="120" Height="30" Grid.Row="0"
    Grid.Column="1"></TextBox>
    <TextBlock Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right"
    VerticalAlignment="Center">Password:</TextBlock>
    <PasswordBox x:Name="pass" Width="120" Height="30"
    Grid.Row="1" Grid.Column="1"></PasswordBox>
    <Button Height="30" Width="60" Grid.Row="2" Grid.ColumnSpan="2"
    Click="Button_Click">Ok</Button>
</Grid>

Code behind:

private void Button_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?

4

0 回答 0