开发者

password box show chars

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜