Exemplo n.º 1
0
        private async void IngredientsEntry_TextChangedAsync(object sender, TextChangedEventArgs e)
        {
            List <string> autocomplete = await ingredientController.AutocompleteIngredientSearchAsync(ingredientsEntry.Text, 10);

            Suggestions.Children.Clear();
            foreach (string suggestion in autocomplete)
            {
                Button button = new Button {
                    Text = suggestion
                };
                button.Clicked += SuggestionButton_Clicked;
                Suggestions.Children.Add(button);
            }
        }
Exemplo n.º 2
0
        private async void Entry_TextChangedAsync(object sender, TextChangedEventArgs e)
        {
            List <string> autocomplete = await _ingredientController.AutocompleteIngredientSearchAsync(Entry.Text, 10);

            Suggestions.Children.Clear();
            foreach (string suggestion in autocomplete)
            {
                Button button = new Button {
                    Text = suggestion, BackgroundColor = Color.FromHex("#5577AA"), TextColor = Color.White, Padding = 0, Margin = 4, FontSize = 11, HeightRequest = 32
                };
                button.Clicked += SuggestionButton_Clicked;
                Suggestions.Children.Add(button);
            }
        }