我有这个 android View,我正在使用 LegacyBar:
public class BaseView : MvxActivity
{
public override void SetContentView(int layoutResId)
{
base.SetContentView(layoutResId);
var bar = FindViewById<LB.LegacyBar>(Resource.Id.actionbar);
bar.SetHomeLogo(Resource.Drawable.Icon);
var attr = this.GetType()
.GetCustomAttributes(typeof(ActivityAttribute), true)
.FirstOrDefault() as ActivityAttribute;
if (attr != null)
bar.Title = attr.Label;
bar.SetHomeAction(new ActionLegacyBarAction(ApplicationContext, doHomeAction, Resource.Drawable.Icon));
}
public ICommand homeActionClicked { get; set; }
private void doHomeAction()
{
if (homeActionClicked != null && homeActionClicked.CanExecute(null))
homeActionClicked.Execute(null);
}
}
homeActionClicked
将此视图中定义的绑定到其视图模型中的命令的正确方法是什么?或者也许我应该制作一个自定义控件并将栏放在里面然后绑定控件的命令?