WPF PasswordBox在现实世界中不可用,因为1.它不可绑定,并且2.是密封类 [英] WPF PasswordBox is not usable in the real world because 1. It is not bindable and 2. It is a sealed class

查看:402
本文介绍了WPF PasswordBox在现实世界中不可用,因为1.它不可绑定,并且2.是密封类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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,(

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!

推荐答案

您好,rhoyous,

Hi rhyous,

感谢敌人分享此反馈和功能要求!不幸的是,该版本中的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.

此致
鲍勃

MSDN论坛中的订阅者支持

如果您对我们的支持有任何反馈,请联系 msdnmg@microsoft.com

If you have any feedback on our support, please contact msdnmg@microsoft.com


这篇关于WPF PasswordBox在现实世界中不可用,因为1.它不可绑定,并且2.是密封类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆