Click here to Skip to main content
15,924,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I am new to wpf, I have stuck in some problem.
I have a list in which can very based on different scenarios.
Now based on the no. Of elements in the list I need to create passwordbox in dialog.
Ex.
Name1 passwordbox
Name2 passwordbox
.
.
Can anyone help me out for this.

What I have tried:

I tried creating passwordbox bt not succeeded.
Posted
Updated 6-Jan-19 5:27am

1 solution

If I understand correctly, the amount of name / password combinations is decided at runtime?

If that is the case, one way could be to use DataGrid Class (System.Windows.Controls) | Microsoft Docs[^] control to handle the varying amount of rows and have two columns, name and password. For the password column you could use DataGridTemplateColumn.CellTemplate Property (System.Windows.Controls) | Microsoft Docs[^] to define the actual control to be used for a cell in that column, namely PasswordBox.

There are quite a lot discussions for such approach, for example c# - Why does the WPF PasswordBox go blank sometimes but not others? - Stack Overflow[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900