This is a migrated thread and some comments may be shown as answers.

Binding PasswordBox control to create user.

3 Answers 809 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 1
Alan asked on 21 Mar 2011, 05:02 PM
Hi,

I'm trying to use this control for user management, I am aware that you're not supposed to bind to PasswordBox field, and I do not intend to, but I would like to have the field there when you're going to insert a new user or edit a current user (in the case of edit it would be an empty text field).

How would you go about achieving this?

Thanks,
Daryl

3 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 22 Mar 2011, 08:39 AM
Hello Daryl,

 
In this case you have to manually define the fields in RadDataForm and set the PasswordBox as its content as shown below:

<telerik:DataFormDataField  Label="PersonalInfo:">
                     <PasswordBox Password="{Binding PersonalInfo,Mode=TwoWay}" PasswordChar="*"/>
</telerik:DataFormDataField>

Also you may check our online demos and documentation for more information.


Kind regards,
Vanya Pavlova
the Telerik team
0
Alan
Top achievements
Rank 1
answered on 22 Mar 2011, 08:47 AM
Hi Vanya,

The problem is that Password doesn't have a DependencyProperty. So when you try to bind the password, you'll get this error:

A 'Binding' cannot be set on the 'Password' property of type 'PasswordBox'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject.

Hence my original question.

Thank you for your help,
Daryl
0
Accepted
Vanya Pavlova
Telerik team
answered on 22 Mar 2011, 04:52 PM
Hello Daryl,

 
I have spent some time to investigate this case. The main reason that the PasswordBox control for both WPF/Silverlight does not expose  a DependencyProperty for the Password property is due to security reasons and generally should be avoided. I have found two interesing threads which might be useful for you to fetch this limitation:
                                                                "PasswordBox and Binding"
                                                          "PasswordBox and Binding MVVM"  


In case you need any further assistance, please let me know.

Kind regards,
Vanya Pavlova
the Telerik team
Tags
DataForm
Asked by
Alan
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Alan
Top achievements
Rank 1
Share this question
or