The code looks like this and as I mentioned in my title, the code works but only with 1 item but I want it to search the list with an additional item.
This is my functional code (1 item named irl1):
private void FilterContacts(string filter)
{
EmployeeList.BeginRefresh();
if (string.IsNullOrWhiteSpace(filter)) {
System.Diagnostics.Debug.WriteLine("if1");
EmployeeList.ItemsSource = ourPitems;
} else {
System.Diagnostics.Debug.WriteLine("else2");
EmployeeList.ItemsSource = ourPitems.Where(x => x.irl1.ToLower ().Contains (filter.ToLower ()));
}
EmployeeList.EndRefresh ();
}
and what I am trying to do does not work:
EmployeeList.ItemsSource =
ourPitems.Where(
x => x.ourMadeUpNationality.ToLower(),
oem => oem.irl1.ToLower().Contains(filter.ToLower())
);
and while I'm at it, I tried to make the list refresh when I drag it up, but it just keeps loading, when I search in my list it updates. What I have tried to do is this but It does not seem to work.
public StartPage()
{
InitializeComponent();
//add the refresh function here.
EmployeeList.BeginRefresh();
// this is for the search list.
sbSearch.TextChanged += (sender2, e2) => FilterContacts(sbSearch.Text);
// this is for the search list.
sbSearch.SearchButtonPressed += (sender2, e2) => FilterContacts(sbSearch.Text);
EmployeeList.EndRefresh();
}
EmployeeList.ItemsSource = ourPitems.Where(tk => tk.irl1.ToLower()。Contains(filter.ToLower())&& tk.ourMadeUpNationality ==“ Test1”);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.