Adding a PasswordBox Attached Property

360 Views Asked by At

I have a very low security application. I would like to add an Attached Property to a PasswordBox so I may bind to it. I realize the security issues associated with doing this.

I have copied this seemingly well known code: http://blog.functionalfun.net/2008/06/wpf-passwordbox-and-data-binding.html

I added the proper xmlns for my app:

xmlns:w="clr-namespace:gobo2018.HelperClass"

And, my PasswordBox xaml:

<PasswordBox x:Name="userPasswordBox" Grid.Row="2" Grid.Column="1" 
             w:PasswordBoxAssistant.BindPassword="True"
             w:PasswordBoxAssistant.BoundPassword="{Binding Path=Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">

</PasswordBox>

However, I am getting "doesn't exist in the namespace..." which I don't understand, especially since the intellisense recognizes "w:PasswordBoxAssistant.BindPassword..."

enter image description here

Picture of the HelperClass... enter image description here

Output Message: System.Windows.Data Error: 40 : BindingExpression path error: 'Password' property not found on 'object' ''ActiveJobViewModel' (HashCode=6122357)'. BindingExpression:Path=Password; DataItem='ActiveJobViewModel' (HashCode=6122357); target element is 'PasswordBox' (Name='userPassWordBox'); target property is 'BoundPassword' (type 'String')

1

There are 1 best solutions below

0
On

Restarting my machine resolved the "doesn't exist in the namespace..." problem.