0

我正在为 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';
    }`

在这种情况下我能做什么?

4

1 回答 1

0

但是当我编辑值或将符号复制到密码框中时 - 没有按钮。

当然这是可能的,它的可见性password reveal button是由很多事情决定的,而不仅仅是IsPasswordRevealButtonEnabled财产的价值。

此属性的值不是确定密码显示按钮是否对用户在 UI 中可见的唯一因素。其他因素包括控件是否显示在最小宽度之上PasswordBox 是否具有焦点以及文本输入字段是否包含至少一个字符

来源:https ://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.passwordbox.ispasswordrevealbuttonenabled

于 2015-02-08T14:06:47.943 回答