I have created login authentication using MVVM and it worked fine. This is what I have done:
MainWinodw.xaml
  <Window.Resources>
    <BooleanToVisibilityConverter x:Key="BoolToVis" />
</Window.Resources>
<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <TextBlock Grid.Row="0" Grid.Column="0">UserName:</TextBlock>
    <TextBlock Grid.Row="1" Grid.Column="0">Password:</TextBlock>
    <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding UserName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
    <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
    <Label Grid.Row="3" Grid.ColumnSpan="2" Visibility="{Binding isAuthenticated, Converter={StaticResource BoolToVis}}">
        User has been authenticated
    </Label>
    <Label Grid.Row="3" Grid.ColumnSpan="2" Visibility="{Binding LoginFail, Converter={StaticResource BoolToVis}}">
         Please enter valid  UserName and Password
    </Label>
    <Button Grid.Row="2" Grid.Column="1" Content="Authenticate" Command="{Binding LoginCommand}" Margin="3" Width="100" HorizontalAlignment="Right" />
</Grid>
UserViewModel.cs
public class LoginViewModel : INotifyPropertyChanged
{
    private bool _isAuthenticated;
    public bool isAuthenticated
    {
        get { return _isAuthenticated; }
        set
        {
            if (value != _isAuthenticated)
            {
                _isAuthenticated = value;
                OnPropertyChanged("isAuthenticated");
            }
        }
    }
    private bool _loginFail;
    public bool LoginFail
    {
        get { return _loginFail; }
        set
        {
            if (value != _loginFail)
            {
                _loginFail = value;
                OnPropertyChanged("LoginFail");
            }
        }
    }
    private string _username;
    public string UserName
    {
        get { return _username; }
        set
        {
            _username = value;
            OnPropertyChanged("UserName");
        }
    }
    private string _password;
    public string Password
    {
        get { return _password; }
        set
        {
            _password = value;
            OnPropertyChanged("Password");
        }
    }
    public ICommand LoginCommand
    {
        get { return new RelayCommand(param => this.Login()); }
    }
    public void Login()
    {
        //TODO check username and password vs database here.
        //If using membershipprovider then just call Membership.ValidateUser(UserName, Password)
        //if (!String.IsNullOrEmpty(UserName) && !String.IsNullOrEmpty(Password))
        //    isAuthenticated = true;
        isAuthenticated = LoginDataLayer.AuthenticateUser(UserName, Password);
        if(isAuthenticated == true)
        {
            LoginFail = false;
        }
        else
        {
            LoginFail = true;
        }
    }
    #region INotifyPropertyChanged Methods
    public void OnPropertyChanged(string propertyName)
    {
        this.OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
    }
    protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)
    {
        if (this.PropertyChanged != null)
        {
            this.PropertyChanged(this, args);
        }
    }
    public event PropertyChangedEventHandler PropertyChanged;
    #endregion
}
This is working fine. But as I said I'm new to MVVM. I write model code also in viewmodel. After realizing my mistake I tried to separate model and view model code like this:
UserModel.cs
 public  class UserModel : INotifyPropertyChanged
{
    private bool _isAuthenticated;
    public bool isAuthenticated
    {
        get { return _isAuthenticated; }
        set
        {
            if (value != _isAuthenticated)
            {
                _isAuthenticated = value;
                OnPropertyChanged("isAuthenticated");
            }
        }
    }
    private bool _loginFail;
    public bool LoginFail
    {
        get { return _loginFail; }
        set
        {
            if (value != _loginFail)
            {
                _loginFail = value;
                OnPropertyChanged("LoginFail");
            }
        }
    }
    private string _username;
    public string UserName
    {
        get { return _username; }
        set
        {
            _username = value;
            OnPropertyChanged("UserName");
        }
    }
    private string _password;
    public string Password
    {
        get { return _password; }
        set
        {
            _password = value;
            OnPropertyChanged("Password");
        }
    }
    #region INotifyPropertyChanged Methods
    public void OnPropertyChanged(string propertyName)
    {
        this.OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
    }
    protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)
    {
        if (this.PropertyChanged != null)
        {
            this.PropertyChanged(this, args);
        }
    }
    public event PropertyChangedEventHandler PropertyChanged;
    #endregion
}
UserViewModel.cs
public void Login()
    {
        UserModel obj = new UserModel();
        obj.isAuthenticated = LoginDataLayer.AuthenticateUser(obj.UserName,obj. Password);
        if(obj.isAuthenticated == true)
        {
           obj.LoginFail = false;
        }
        else
        {
            obj.LoginFail = true;
        }
    }
But I am getting obj.username is null. So can anyone help me how I get model property in view model and how can it update. Please help. Thanks
 
    