private void FillDataSetButton_Click(object sender, EventArgs e) { CustomersAdapter.Fill(northwindDataSet1.Customers); OrdersAdapter.Fill(northwindDataSet1.Orders); CustomersGrid.DataSource = northwindDataSet1.Customers; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SelectCustomer); Android.Widget.SearchView searchView = FindViewById <Android.Widget.SearchView>(Resource.Id.searchViewCustomers); //get all customers from database customers = DatabaseRequest.GetAllFromTable <Customer>().OrderBy(x => x.Company).ToList(); //populate RecyclerView with all customers customersRecyclerView = FindViewById <RecyclerView>(Resource.Id.customersRecyclerView); customersLayoutManager = new LinearLayoutManager(this); customersRecyclerView.SetLayoutManager(customersLayoutManager); customersAdapter = new CustomersAdapter(customers); customersAdapter.ItemClick += OnItemClick; customersRecyclerView.SetAdapter(customersAdapter); searchView.QueryTextChange += delegate { string currentSearchViewValue = searchView.Query; var currentCustomersSearched = customers.Where(x => x.Company.ToLower().Contains(currentSearchViewValue.ToLower())).ToList(); //repopulate RecyclerView with currentCustomersSearched customersAdapter = new CustomersAdapter(currentCustomersSearched); customersAdapter.ItemClick += OnItemClick; customersRecyclerView.SetAdapter(customersAdapter); }; }