Local search with detail for each typed letter - Xamarin Forms

Asked

Viewed 41 times

0

With each typed letter appears a white ball in the middle of the app (by the way is updating the list), I wish I could not have this.

The mistake:

inserir a descrição da imagem aqui

The code:

//Pesquisa localmente a cada letra digitada
private void OnTextChanged(object sender, TextChangedEventArgs e)
{
    //Letra Maiúscula
    MainSearchBar.Text = MainSearchBar.Text.ToUpper();

    //Pesquisa a cada dígito
    lstProduto.BeginRefresh();
    if (string.IsNullOrWhiteSpace(e.NewTextValue))
    {
        lstProduto.ItemsSource = produtos;
    }
    else
    {
        lstProduto.ItemsSource = produtos.Where(i => i.DESCRICAO.Contains(e.NewTextValue));
    }
    lstProduto.EndRefresh();
}
  • 1

    Please put as answer (it worked).

1 answer

1


In his method OnTextChanged you are activating the property IsRefreshing of his ListView.

Here:

//Pesquisa localmente a cada letra digitada
private void OnTextChanged(object sender, TextChangedEventArgs e)
{
    ...
    lstProduto.BeginRefresh();
    ...
    lstProduto.EndRefresh();
}

Between these two calls (BeginRefresh and EndRefresh), the component Listview displays the 'busy' indicator'.

Just remove these two calls and the indicator will no longer appear.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.