public ItemsViewModel() { Title = "Browse"; Items = new ObservableCollection <Item>(); LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand()); MessagingCenter.Subscribe <NewItemPage, Item>(this, "AddItem", async(obj, item) => { var newItem = item as Item; Items.Add(newItem); await ItemStore.AddItemAsync(newItem); }); }
public ItemsViewModel() { Title = "My Fridge"; Items = new ObservableCollection <Item>(); DBItems = new ObservableCollection <string>(); LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand()); var listView = new ListView { ItemTemplate = new DataTemplate(typeof(InventoryItemCell)) }; MessagingCenter.Subscribe <NewItemPage, Item>(this, "AddItem", async(obj, item) => { var newItem = item as Item; Items.Add(newItem); await ItemStore.AddItemAsync(newItem); }); }