问题描述
PasswordBox在生产代码中不可用的原因有两个.
There are two reasons why the PasswordBox is not usable in production code.
1.密码框不接受绑定.我完全理解绑定String PasswordBox.Password值是不安全的,不建议这样做.但是,不允许将SecurePassword属性设置为DependencyProperty是没有任何借口的.然而, 有些人仍然想绑定PasswordBox.使用PasswordBox,因为除了隐藏密码外,他们几乎不需要安全保护.
1. The Password box doesn't accept binding. I fully understand that binding the String PasswordBox.Password value is insecure and not recommended. But there is not excuse for not allowing make the SecurePassword property a DependencyProperty. However, some people still want to bind PasswordBox.Password it as they may have very little need for security other than obscuring the password.
2.该类是密封的.是的,密封!这意味着如果我们要从中派生DigitOnlyPasswordBox,例如PinNumbers,().另外,最好在此处创建一个派生的DBPasswordBox来自动应用密码规则列表:http://msdn.microsoft.com/zh-cn/library/ms161959%28v=SQL.105%29.aspx.我想我可能会接受这样的事实 如果该类的属性"是不允许使用的字符的字符数组,并且具有DigitsOnly,AlphaOnly和AlphaNumericOnly的枚举属性,则该类将被密封.
2. The class is sealed. Yes, sealed! That means that if we want to derive a DigitOnlyPasswordBox from it, for say PinNumbers, (see my DigitBox derived from a TextBox here ). Also, it would be nice to create a derived DBPasswordBox that automatically applies password rules list here: http://msdn.microsoft.com/en-us/library/ms161959%28v=SQL.105%29.aspx. I think I might accept the fact that this class was sealed if it had a Property that was a character array of characters that are not allowed, and had an enum property for DigitsOnly, AlphaOnly, and AlphaNumericOnly.
因此,由于这两个功能未在.NET 4中出现,因此我希望请求在.NET 4 SP1中进行这两项更改.或者至少发布具有这些功能的WPF工具包之类的东西.
So since these two features did not come out in .NET 4, I would like to request these two changes be made in .NET 4 SP1. Or at least release something like the WPF Toolkit that has these features.
A,我现在必须编写自己的密码控件!
Alas, I must write my own Password Control for now!
推荐答案
感谢敌人分享此反馈和功能要求!不幸的是,该版本中的PasswordBox可能无法满足您的要求,它是密封类,并且SecurePassword属性不是DependencyProperty.我认为,出于安全性考虑,WPF设计 带有一些私有方法的PasswordBox来访问内部属性.
Thanks foe sharing this feedback and the feature request! Unfortunately, the PasswordBox in the version may not meet your requirement, it is a sealed class, and SecurePassword property is not a DependencyProperty. I think, for the security, WPF designs the PasswordBox with some private methods to access the inner properties.
再次感谢您的反馈. Microsoft有一个站点,我们可以提交对该产品的反馈-连接站点,您可以在此站点上发送您的反馈/功能请求关于WPF产品: https://connect.microsoft.com/WPF ,我们的开发人员将认真评估它们并采取在设计产品的将来版本时要考虑它们.
And thank you again for this feedbacks. Microsoft has a site we can submit the feedbacks for the product -- Connect site, you could send your feedbacks/feature requests on this site about the WPF product:https://connect.microsoft.com/WPF, and Our developer will evaluate them seriously and take them into consideration when designing future release of the product.
此致
鲍勃
如果您对我们的支持有任何反馈,请联系 [email protected]
If you have any feedback on our support, please [email protected]
这篇关于WPF PasswordBox在现实世界中不可用,因为1.它不可绑定,并且2.是密封类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!