public RecipeEditor(int bookId, IRecipe recipe) { InitializeComponent(); _bookId = bookId; _recipe = recipe; IngredientContainer.Children.Clear(); LoadContent(); this.KeyDown += (sender, keyEvent) => { if (keyEvent.Key == Key.Enter && !RecipeName.IsFocused) { IngredientInput input = new IngredientInput(); IngredientContainer.Children.Add(input); input.Select(); } }; }
public CreateRecipe(int bookID, RoutedEventHandler listener) { InitializeComponent(); _bookId = bookID; IngredientContainer.Children.Clear(); ingredientAdd.Click += IngredientAdd; IngredientContainer.Children.Add(new IngredientInput()); createBtn.Click += createRecipe; createBtn.Click += listener; this.KeyDown += (sender, keyEvent) => { if (keyEvent.Key == Key.Enter && !RecipeName.IsFocused) { IngredientInput input = new IngredientInput(); IngredientContainer.Children.Add(input); input.Select(); } }; }