Exemplo n.º 1
0
 private void NewIngredientList_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     NewIngredientDropDown.IsOpen = false;
     if (e.AddedItems.Count == 0)
         return;
     var itemName = e.AddedItems[0].ToString();
     _item.Ingredients.Add(new StockItem(itemName));
     using (var dataStorage = new DataStorage())
         _item.Ingredients.Last().Unit = dataStorage.StockItem(itemName).Unit;
     StockDataGrid.Focus();
     StockDataGrid.CurrentCell = new DataGridCellInfo(StockDataGrid.Items[StockDataGrid.Items.Count - 1], StockDataGrid.Columns[1]);
     StockDataGrid.BeginEdit();
 }