WPF Filtrar um ListBox
Eu carrego uma lista de seqüências de caracteres no meuListBox
, agora eu quero filtrar quando eu inserir texto em umTextBox
. Como eu posso fazer isso?
public void ListLoad()
{
ElementList = new List<string>(); // creation a list of strings
ElementList.Add("1"); // add a item of string
ElementList.Add("2"); // add a item of string
DataContext = this; // set the data context
}
Eu estou ligando em XAML com:
ItemsSource = "{Binding ElementList}"