public void LoadRecipes() { RecipesStack.Children.Clear(); foreach (var p in FilteredRecipesList) { var t = new Button { Content = p.Name + " (" + p.Time + " хв)", Name = "rec" + Convert.ToString(p.Id) }; t.Click += (s, e) => { var r = new RecipeWindow(this, p.Id); r.Show(); this.Hide(); }; RecipesStack.Children.Add(t); } }
private void NewRecipeButton_Click(object sender, RoutedEventArgs e) { var p = new RecipeWindow(this, -1); p.Show(); this.Hide(); }