PasswordBox.Password doesn't have a corresponding DependencyProperty, so you can't data-bind to it.Įxposing a DependencyProperty would require us to store the PasswordBox content plain text in memory in the property system - which is a security concern. With binding, I simply know that there some data object bound to the page (or window, dialog, etc) and then get the password value from that object. Without binding, I would have to know the name associated with the password box and then from code get a reference to the password box and directly access its Password property. I would like to bind to the Password box for the reason why you would want to data-bind anything.that is to enable the UI (XAML) to be less coupled to the application logic. In what scenario would you ever want to databind to a password box It is probably not a DP because Microsoft doesn't see any point in it being one and I'm inclined to share that perspective. You can't bind the property beause it is not a DependencyProperty. Is string the wrong type.I tried char with the same result. Object of type '' cannot be converted to type 'System.String'. When I attempt to bind to the Password property of the PasswordBox (binded to a property on an object that returns a string), I get the following error: Posted: Windows Presentation Foundation (WPF), Unable to data-bind to a PasswordBox Index ‹ Visual Studio 2008 ‹ Windows Presentation Foundation (WPF)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |