/// <summary> /// Clears the selected elements in list/comboBoxes, and the product name textBox /// </summary> private void ClearSelected() { ProductNameTextBox.Text = ""; ProductsListBox.ClearSelected(); ProductsListBox.SelectedItem = null; ProductCategoryComboBox.SelectedItem = null; RecipesListBox.ClearSelected(); RecipesListBox.SelectedItem = null; }
/// <summary> /// Resets the form elements/selected items and clears the selected recipe's ingredients list /// </summary> private void ResetForm() { ProductsListBox.ClearSelected(); SelectedRecipeContentListbox.ClearSelected(); RecipesListBox.ClearSelected(); RecipeNameTextBox.Text = ""; SelectedRecipeContent.Clear(); ClearRecipeContentList(); }
//if selectedProduct has a recipe - display it in the recipe listbox private void DisplayRecipeIfExists(ProductModel selectedProduct) { if (selectedProduct.RecipeId != null) { RecipesListBox.SelectedItem = RecipeList.Where(r => r.Id == selectedProduct.RecipeId).First(); } else { RecipesListBox.ClearSelected(); } }