Clearing the value of an Entry that has IsPassword="true"

I have a login form which makes use of an Entry view with IsPassword set to true.

behaviour is all working and fine minus 1 thing.

On a failed login, I attempt to empty the password entry using Details.Password = string.empty; and also tried using simply "" instead of string.empty

The property is indeed empty on inspection, however the entry does not update to reflect this change. Is this a normal behaviour for an entry with ispassword? or is this a bug?

for info Details is a class which contains the properties Email and Password which are bound to respective entry views.

Tagged:

Best Answer

Answers

  • NamyslawSzymaniukNamyslawSzymaniuk ✭✭✭✭ USMember ✭✭✭✭

    I'm using Binding of Text property for Entry, that has IsPassword = true, and haven't any issues with clearing value from ViewModel code.

  • GrahamHickson.2156GrahamHickson.2156 ✭✭ USMember ✭✭

    Issue resolved..

    achieved by creating new instance of the bindingmodel, updating the email, and applying that model to the property

  • ClintStLaurentClintStLaurent ✭✭✭✭✭ USUniversity ✭✭✭✭✭

    A new instance of the binding model. ??? Sounds like you have some deeper issues to resolve.
    I'm doing MVVM exactly as @NamyslawSzymaniuk describes and it works as expected. Just have to clear the text property that is being used for the entered password and the Entry updates as it should.
    If you're having to make a new model then you probably don't have proper binding to begin with, or don't have a proper property that raises the INotifyPropertyChanged event.

  • GrahamHickson.2156GrahamHickson.2156 ✭✭ USMember ✭✭

    offending code was:

    Details.Password = string.empty;

    which has been resolved with:

    Details = new LoginBindingModel()
    {
    Email = Details.Email
    };

Sign In or Register to comment.