public override void ViewDidLoad() { base.ViewDidLoad(); //iOS Image Search code viewModel = new ImageSearchViewModel(); CollectionViewImages.WeakDataSource = this; //Button Click event to get images ButtonSearch.TouchUpInside += async(sender, args) => { ButtonSearch.Enabled = false; ActivityIsLoading.StartAnimating(); await viewModel.SearchForImagesAsync(TextFieldQuery.Text); CollectionViewImages.ReloadData(); ButtonSearch.Enabled = true; ActivityIsLoading.StopAnimating(); }; //IOS Keyboard Done Code var toolbar = new UIToolbar(new CGRect(0.0f, 0.0f, TextFieldQuery.Frame.Size.Width, 44.0f)); toolbar.Items = new[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate { TextFieldQuery.ResignFirstResponder(); }) }; TextFieldQuery.InputAccessoryView = toolbar; }
private static string GetFullTextString(this TextFieldQuery fq) { if (fq == null) { throw new ArgumentNullException(nameof(fq)); } string fullTextString; switch (fq.Operator) { case TextFieldValueOperator.Contains: case TextFieldValueOperator.Equals: fullTextString = $"\"{fq.Value}\""; break; case TextFieldValueOperator.StartsWith: fullTextString = $"\"{fq.Value}*\""; break; default: throw new ApplicationException("Only Contains, Equals and EndsWith operators are allowed"); } switch (fq.Disposition) { case QueryDisposition.Required: fullTextString += " AND "; break; case QueryDisposition.Optional: fullTextString += " OR "; break; case QueryDisposition.Forbidden: fullTextString += " AND NOT "; break; } return(fullTextString); }