private void btnHapus_click(object sender, RoutedEventArgs e) { try { int index = 0; for (int i = 0; i < listPilihHapus.Count; i++) { ProsesItem cariElemenList = listItemDibeli.Where <ProsesItem>(x => x.namaBarang == arrayNamaBarang[i]).Single <ProsesItem>(); index = listItemDibeli.IndexOf(cariElemenList); listItemDibeli.RemoveAt(index); } counter = 0; itemBarangTerpilih.ItemsSource = null; itemBarangTerpilih.ItemsSource = listItemDibeli; HargaBarang hargaBarang = new HargaBarang(); HargaPajak harga = new HargaPajak(); outputTotalHarga.Text = "Rp. " + hargaBarang.harga(listItemDibeli).ToString(); outputPajak.Text = "Rp. " + harga.harga(listItemDibeli).ToString(); outputDibayar.Text = "Rp. " + harga.hargaTotal().ToString(); listPilihHapus.Clear(); } catch { } }
protected override void OnNavigatedTo(NavigationEventArgs e) { listItemDibeli = e.Parameter as List <ProsesItem>; itemBarangTerpilih.ItemsSource = listItemDibeli; HargaBarang hargaBarang = new HargaBarang(); HargaPajak harga = new HargaPajak(); outputTotalHarga.Text = "Rp. " + hargaBarang.harga(listItemDibeli).ToString(); outputPajak.Text = "Rp. " + harga.harga(listItemDibeli).ToString(); outputDibayar.Text = "Rp. " + harga.hargaTotal().ToString(); }