protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.RequestWindowFeature(WindowFeatures.NoTitle); SetContentView(Resource.Layout.GoalDetailView); GoalDetailViewModel vm = (GoalDetailViewModel)ViewModel; TextView goalTitle = FindViewById <TextView>(Resource.Id.textview_title); Button btnSelectGoal = FindViewById <Button>(Resource.Id.button_selectgoal); string message = ""; btnSelectGoal.Click += delegate { if (goalTitle.Text.Contains("STARTED")) { message = "You have started this goal ^^ Complete it and mark it in 'My Goal'"; Toast.MakeText(this, message, ToastLength.Long).Show(); } else if (goalTitle.Text.Contains("COMPLETED")) { message = "You have completed this goal today, try different goal to grow your avatar ^^"; Toast.MakeText(this, message, ToastLength.Long).Show(); } else { message = goalTitle.Text + " started"; Toast.MakeText(this, message, ToastLength.Short).Show(); } }; //for images string resourceId = "@drawable/" + vm.Title.ToLower().Trim(); // where myResourceName is the name of your resource file, minus the file extension }
public GoalDetailPage(Goal goal) { InitializeComponent(); BindingContext = new GoalDetailViewModel(goal); }