I am trying to bind ULabel to a Command in a core but can't figure out why it is not working for me. I read that UILabel is bindable to a default Text property so I have the following simple tester to demonstrate:
in Touch code I have the following ViewDidLoad:
var tipLabel = new UILabel(new RectangleF(10, 20, 300, 40));
Add(tipLabel);
var loginBtn = new UIButton(UIButtonType.RoundedRect) { Frame = new RectangleF(10, 100, 100, 40) };
loginBtn.SetTitle("Set Text", UIControlState.Normal);
var tap = new UITapGestureRecognizer(() =>
{
tipLabel.Text = DateTime.Now.ToShortTimeString();
});
loginBtn.AddGestureRecognizer(tap);
Add(loginBtn);
var set = this.CreateBindingSet<FirstView, FirstViewModel>();
set.Bind(tipLabel).For(p=>p.Text).To(vm=>vm.TestCommand);
set.Apply();
and in a core:
private MvxCommand _testCommand;
public ICommand TestCommand
{
get { return this._testCommand ?? (this._testCommand = new MvxCommand(this.Test)); }
}
public void Test()
{
}
what am I missing?
Thank you Mark