
Hi,
do you have a sample of a PasswordPropertyEditor in order to edit a SecureString in a PropertyGrid ?
If not, can you explain how to implement it easily ?
Best regards.
Hi,
do you have a sample of a PasswordPropertyEditor in order to edit a SecureString in a PropertyGrid ?
If not, can you explain how to implement it easily ?
Best regards.
Hi,
I'm sorry but I don't believe we have a built-in property editor for editing a SecureString. However the Editors portion of the Sample Browser has a demo called PropertyGridIntegrationCustom that shows how to make a custom property editor. You could use this sort of info with our Editors' PasswordBox or even the native WPF PasswordBox.
Hi,
yes, actually I saw this sample but can you give me the steps to implement this ?
That particular demo has several extra classes that you don't need to focus on. For instance you can ignore PositiveDoublePropertyEditor, RotationDoublePropertyEditor, SkewDoublePropertyEditor, and TestObject.
You'd just clone the rest of the classes and rename them from using Rect in the names to Password. Instead of using a RectEditBox in the template within PropertyEditors.xaml, you'd use a PasswordBox.
Actually it's not as easy as the RectEditBox, it's not possible to use "bindings" with the password property of the PasswordBox.
So my idea was to create a type which inherits from PasswordBox and use the PasswordChanged event to update the value of the IPropertyDataAccessor.
The problem is: how to initialize the PasswordBox with the value of the IPropertyDataAccessor object ?
Is it the good way to do it ?
True, you won't be able to bind to the Password property since it's not a dependency property. I'd probably recommend that in your inherited class you create a new string dependency property and watch for changes on that. In the XAML template bind the data accessor's value to it. When you get changes to it you can pass them on to the PasswordBox.Password property and when you see PasswordChanged events, pass those back and update your new dependency property's value (as long as there is a change).
Please log in to a validated account to post comments.