I create a list of ListView elements by class, but the list is quite large. How to search among these elements (selection of elements by type as in AutoSuggestBox, that is, I enter a specific name and a sheet of all elements leaves only those where the line I entered is found)?

  • What do you mean by search? Looking for what? And how many items are in the list? - VladD
  • @VladD selection of elements by type as in AutoSuggestBox, that is, I enter a specific name and a sheet of all elements leaves only those where the line that I entered is found. Items over 60+ - Denisok
  • You use the search here, there were already similar questions, they only concerned WPF, but this does not fundamentally change anything. I give a hint: you need to use a LINQ query to select from a large collection into a small one, which you link to your ListView - Bulson

1 answer 1

There is a list, there is a textbox.

  1. Enter the word in the textbox.

  2. Take a collection that is tied to the list, filter it and that's it.

Like that:

КоллекцияВашихЭлементов = КоллекцияВашихЭлементов.FindAll(x => x.Name == "введенноеСлово"); 
  • one
    maybe so? (x => x.Name.Contains ("enteredWord") - tCode
  • Maybe so. It depends on how exact the match is. - Make Makeluv
  • And if my collection - a sheet tied to the class? - Denisok
  • No difference. The main thing that the property supports INotifyPropertyChanged - Make Makeluv