I am new to MVVMCross framework for Android and having trouble on how to enable/disable a button. I wasn't able to find a documentation around this area.
Code ViewModel:
private bool _buttonEnabled;
public bool ButtonEnabled
{
get
{ return string.IsNullOrEmpty(EmailLogin);}
set
{
_buttonEnabled = value;
RaisePropertyChanged(() => ButtonEnabled);
}
}
Android axml:
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/Login"
android:background="@color/yellow"
local:MvxBind="Enabled(ButtonEnabled)"/>
But unable to get it to work. What I'm trying to achieve is that if EmailLogin variable is NullOrEmpty then button should be disabled. Where am i going wrong ?
Hopefully i'm not pushing this but can i add additional binding to it so that if it is disabled or enabled i can change the color of the button ?