MVVM Bindings

RexHopeRexHope PHMember ✭✭
edited July 2017 in Xamarin.Forms

Hi all, I would like to ask why does my basic mvvm bindings doesn't work, see the code below, did I missed something?
//Login.xaml

<local:ButtonLoginCustom Command="{Binding LoginCommand}" Text="Login">
</local:ButtonLoginCustom>`

//Login.xaml.cs

public LoginView()
{
    InitializeComponent();            
    BindingContext = new LoginViewModel();
}

//LoginViewModel

public class LoginViewModel : BaseViewModel
{
    public ICommand _LoginCommand { get; set; }
    public ICommand LoginCommand=>
    _LoginCommand ?? (_LoginCommand = new Command(async () => await ExecuteLoginCommand(), 
        () => !IsBusy));
}

Thanks for thy inputs!

Tagged:

Best Answer

  • RexHopeRexHope PH ✭✭
    Accepted Answer

    Solved the problem. Such a simple mistake, I used the private declared object rather than the property itself. E.g.

    private string x;
    public string X { get { return x; } set { x = value; OnPropertyChanged(); } }
    

Answers

  • RexHopeRexHope PHMember ✭✭
    Accepted Answer

    Solved the problem. Such a simple mistake, I used the private declared object rather than the property itself. E.g.

    private string x;
    public string X { get { return x; } set { x = value; OnPropertyChanged(); } }
    
Sign In or Register to comment.