我正在为 Windows 商店开发一个应用程序并在其中使用 PasswordBox。当我在空框中输入符号时 - 显示“显示密码”按钮。但是当我编辑值或将符号复制到密码框中时 - 没有按钮。xml:
<ScrollViewer Margin="10,15,20,15">
<Grid Margin="35,35,150,35" Visibility="Collapsed">
<Grid.RowDefinitions>
...
<RowDefinition Height="Auto"/>
...
</Grid.RowDefinitions>
...
<PasswordBox x:Name="pxPass" IsPasswordRevealButtonEnabled ="True" Grid.Row="6"/>
...
</Grid>
代码:
private void btnTapped(object sender, TappedRoutedEventArgs e)
{
pxPass.Focus(FocusState.Programmatic);
pxPass.Password = 'string';
}`
在这种情况下我能做什么?