开发者

password box show chars

开发者 https://www.devze.com 2023-03-14 07:57 出处:网络
If passwordchar is x, then user entered password will be changed to xxxxxx, is there a way to show this password as it is instead of passwordchars, when user selects some checkbox \"showpassword\" ?开

If passwordchar is x, then user entered password will be changed to xxxxxx, is there a way to show this password as it is instead of passwordchars, when user selects some checkbox "showpassword" ?开发者_JAVA百科 or based on some event?


You would have to handle this yourself by swapping the PasswordBox for a TextBox bound to the same property. It would probably make sense to create a custom control to handle the interactions and state changes.


This code may help you

 <Grid Margin="-10, 0, -10 0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <toolkit:PhoneTextBox x:Name="PasswordText"  Text="{Binding Password, ElementName=LoginPassword, Mode=TwoWay}" Visibility="{Binding IsChecked, ElementName=ShowCheck,Converter={StaticResource VisibilityConveter}}"/>
                <PasswordBox x:Name="LoginPassword" Password="{Binding Text, ElementName=PasswordText, Mode=TwoWay}" Visibility="{Binding IsChecked, ElementName=ShowCheck,Converter={StaticResource PasswordVisibilityConveter}}"/>
                <CheckBox Content="Show Password" Grid.Row="1" IsChecked="True" x:Name="ShowCheck" />
            </Grid>
0

精彩评论

暂无评论...
验证码 换一张
取 消