private void Box_Dismissing(object sender, DismissingEventArgs e) { if (e.Result == CustomMessageBoxResult.LeftButton) { //voeg toe if (txtNewCategory.Text.Length != 0) { int id = CategoriesViewModel.GetLastIndex(); Category c = new Category() { Name = txtNewCategory.Text, items = new ObservableCollection<Item>(), Id = ++id }; CategoriesViewModel.AddCategorie(c); } } box.Dismiss(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); String id; if (NavigationContext.QueryString.TryGetValue("category", out id)) { category = Categories.FirstOrDefault(c => c.Id == int.Parse(id)); Items = category.GetItems(); txtCategorie.Text = category.Name; listItems.ItemsSource = Items; } }
public void AddCategorie(Category c) { Categories.Add(c); }
public void addCategory(Category category) { categories.Add(category); }