private void DeleteMultiCategory_Click(object sender, RoutedEventArgs e) { foreach (Category item in lvCategory.Items) { ListCategory.Remove(item); conn.DeleteCategory(item); } }
private async void DeleteCategory_Click(object sender, RoutedEventArgs e) { Button btn = sender as Button; try { conn.DeleteCategory(new Category() { CategoryID = Int32.Parse(btn.Tag.ToString()) }); ListCategory.Where(x => x.CategoryID == int.Parse(btn.Tag.ToString())).ToList().All(i => ListCategory.Remove(i)); } catch { await new MessageDialog("Something wrong !").ShowAsync(); } }