If Statement Bug in ICommand

UtkuGKCANUtkuGKCAN USMember
edited January 2017 in General

Hello everyone,

I have a situation about if statement. First I could not believe it and still i think i am wrong about something.

Here is some of my ViewModel code block.

public ICommand LogIn
{
    get
    {
        if (Current.Username == "a")
        {
            return new Command(() => Message = "Username Changed");
        }
        else
        {
            return new Command(() => Message = "Invalid User!");
        }
    }
}

This Command exists for a button in view and Username attribute of Current property is bound by an Entry in View.

Although Username is "a" and program says it is true, statements in else will be terminated.

Please tell me what I am doing wrong? Can it be about Command data type?

Thanks.

Answers

Sign In or Register to comment.