Textbox is used to input simple string type values and some alphanumeric values. What is inserted in the textbox, can be read by the user easily. But when we are creating the login form or any form for security purposes, then we have to hide the text/value written by the user.
For these purposes textbox doesn’t have a password mode in WPF, so we have to use password box in place of textbox. Password box is designed to enter password by the user because, the colleague can’t read the inputted value by us. It doesn’t allow editing options like cut, copy and paste etc.
By using the above code, a password box has been created and when we will write something into this, it will be converted into bullets. The bullets are the standard password character format of windows now like in windows 8.
We can change some of the properties of this password box, which are mostly used in WPF:
For these purposes textbox doesn’t have a password mode in WPF, so we have to use password box in place of textbox. Password box is designed to enter password by the user because, the colleague can’t read the inputted value by us. It doesn’t allow editing options like cut, copy and paste etc.
<StackPanel>
<Label Content="Password" Width="200" Height="25"></Label>
<PasswordBox Width="200" Height="25"/>
</StackPanel>
<Label Content="Password" Width="200" Height="25"></Label>
<PasswordBox Width="200" Height="25"/>
</StackPanel>
By using the above code, a password box has been created and when we will write something into this, it will be converted into bullets. The bullets are the standard password character format of windows now like in windows 8.
We can change some of the properties of this password box, which are mostly used in WPF:
- PasswordChar: used to change the password character. <PasswordBox Width="200" Height="25" PasswordChar="*"/>
- MaxLength: limit the length of the password. <PasswordBox Width="200" Height="25" MaxLength=”6”/>
Tidak ada komentar:
Posting Komentar