public AddPhotoView() : base(UITableViewStyle.Grouped, null) { var title = new EntryElement("Title", "Enter the photo title", String.Empty); var name = new EntryElement("Name", "Enter your name", String.Empty); var chooseFile = new StringElement("Choose Photo", () => { NavigationController.PresentViewController(imagePicker, true, null); }); this.Pushing = true; Root = new RootElement("Submit Photo") { new Section("") { title, }, new Section("") { name }, new Section("") { chooseFile }, }; this.NavigationItem.SetRightBarButtonItem( new UIBarButtonItem(UIBarButtonSystemItem.Save, (sender, args) => { string photoTitle = title.Value; string AddedBy = name.Value; //validate if (photoTitle == String.Empty || AddedBy == String.Empty || imageView.Image == null) { new UIAlertView("Invalid Entry", "All fields are required.", null, "ok", null).Show(); } else { Downloader downloader = new Downloader(); Stream s = (imageView.Image).AsPNG().AsStream(); DisplayProgress("Submitting Photo"); Task.Factory.StartNew(() => { success = downloader.AddPhoto(photoTitle, AddedBy, ImageHelper.ReadFully(s)); }).ContinueWith(task3 => { HideProgress(); View.BackgroundColor = UIColor.White; if (success > 0) { new UIAlertView("Photo Submitted", "Thank you! Your photo will be posted after review.", null, "ok", null).Show(); this.NavigationController.PopViewControllerAnimated(true); } else { new UIAlertView("Photo Not Submitted", "Uh oh something went wrong. Please try again.", null, "ok", null).Show(); } }, TaskScheduler.FromCurrentSynchronizationContext()); } }), true); imagePicker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary; imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.PhotoLibrary); imagePicker.FinishedPickingMedia += Handle_FinishedPickingMedia; imagePicker.Canceled += Handle_Canceled; imageView = new UIImageView(new RectangleF(10, 210, 300, 300)); this.Add(imageView); }