1/30/2024 0 Comments Passwordbox binding wpf![]() Private Shared Sub SetIsUpdating(dp As DependencyObject, value As Boolean) Return CBool(dp.GetValue(IsUpdatingProperty)) Private Shared Function GetIsUpdating(dp As DependencyObject) As Boolean Public Shared Sub SetPassword(dp As DependencyObject, value As String) Return DirectCast(dp.GetValue(PasswordProperty), String) Public Shared Function GetPassword(dp As DependencyObject) As String Return CBool(dp.GetValue(AttachProperty)) Public Shared Function GetAttach(dp As DependencyObject) As Boolean Public Shared Sub SetAttach(dp As DependencyObject, value As Boolean) Private Shared ReadOnly IsUpdatingProperty As DependencyProperty = DependencyProperty.RegisterAttached("IsUpdating", GetType(Boolean), GetType(PasswordHelper)) Public Shared ReadOnly AttachProperty As DependencyProperty = DependencyProperty.RegisterAttached("Attach", GetType(Boolean), GetType(PasswordHelper), New PropertyMetadata(False, New Propert圜hangedCallback(AddressOf Attach))) Public Shared ReadOnly PasswordProperty As DependencyProperty = DependencyProperty.RegisterAttached("Password", GetType(String), GetType(PasswordHelper), New FrameworkPropertyMetadata(String.Empty, New Propert圜hangedCallback(AddressOf OnPasswordPropert圜hanged))) Public NotInheritable Class PasswordHelper The XAML all works the same as the example. Below is the VB.NET version of the PasswordHelper class. The example is written in C# so I had to port it to VB.NET for my project. I stumbled on the following article which details creating PasswordHelper class allowing data binding and keeping with the MVVM pattern. One issue we ran into was that you cannot data bind to the password property of the PasswordBox since it is not a dependency property. I am currently working with a client that is writing a WPF application using VB.NET.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |