【WPF】PasswordBox使用

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/SevenGirl2017/article/details/84498757

界面展示

在这里插入图片描述
在这里插入图片描述

代码展示

设计界面

<PasswordBox Name="Pwd" FontSize="20" Foreground="White"  Background="Transparent" BorderThickness="0" 
MaxLength="11" Margin="95,80,95.8,125.8" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"  >

后台

//获取PasswordBox中的输入值
string a=Pwd.Password;

属性说明

MaxLength=“11” //输入长度限制
HorizontalContentAlignment=“Center” //输入内容水平居中
VerticalContentAlignment=“Center” //输入内容垂直居中

猜你喜欢

转载自blog.csdn.net/SevenGirl2017/article/details/84498757