//TODO: Step 13 - Listen for the Checkmark gesture protected void WireUpCheckmarkGestureRecognizer() { // create the recognizer checkmarkGesture = new CheckmarkGestureRecognizer(); // wire up the event handler checkmarkGesture.AddTarget(() => { //TODO: Step 14 - Check the state of the gesture if (checkmarkGesture.State != UIGestureRecognizerState.Recognized || checkmarkGesture.State != UIGestureRecognizerState.Ended) { return; } BeginInvokeOnMainThread(() => { imgCheckmark.Image = UIImage.FromBundle( isChecked ? "Images/CheckBox_Checked.png" : "Images/CheckBox_Unchecked.png"); }); isChecked = !isChecked; }); //TODO: Step 15 - Add the gesture to the view View.AddGestureRecognizer(checkmarkGesture); }
protected void WireUpCheckmarkGestureRecognizer() { // create the recognizer checkmarkGesture = new CheckmarkGestureRecognizer(); // wire up the event handler checkmarkGesture.AddTarget(() => { if (checkmarkGesture.State == (UIGestureRecognizerState.Recognized | UIGestureRecognizerState.Ended)) { if (isChecked) { imgCheckmark.Image = UIImage.FromBundle("Images/CheckBox_Unchecked.png"); } else { imgCheckmark.Image = UIImage.FromBundle("Images/CheckBox_Checked.png"); } isChecked = !isChecked; } }); // add the gesture recognizer to the view View.AddGestureRecognizer(checkmarkGesture); }