private async void OnSearch(object sender, EventArgs e) { DbTransaction dbTransaction = DbTransaction.GetInstance(); List <Register> allRegisters = await dbTransaction.GetRegisters(); List <Register> filteredRegisters = GetFilteredRegisters(allRegisters); registerDataGrid.RowDefinitions = new RowDefinitionCollection(); registerDataGrid.Children.Clear(); for (int i = 0; i < filteredRegisters.Count; i++) { registerDataGrid.RowDefinitions.Add(new RowDefinition()); registerDataGrid.Children.Add(new Label { BackgroundColor = Color.White, Text = filteredRegisters[i].TransactionDate.ToString("dd/MM/yyyy") }, 0, i); registerDataGrid.Children.Add(new Label { BackgroundColor = Color.White, Text = filteredRegisters[i].BillNo }, 1, i); registerDataGrid.Children.Add(new Label { BackgroundColor = Color.White, Text = filteredRegisters[i].PartyName }, 2, i); registerDataGrid.Children.Add(new Label { BackgroundColor = Color.White, Text = filteredRegisters[i].City }, 3, i); registerDataGrid.Children.Add(new Label { BackgroundColor = Color.White, Text = filteredRegisters[i].Amount }, 4, i); } }