/// <summary> /// Creates the window based off of a combo item being created. /// </summary> /// <param name="combo">The combo item being created.</param> private void CreateComboItem(ComboItem combo) { //Entree ComboBox entreeCb = new ComboBox(); entreeCb.FontSize = 16; entreeCb.Margin = new Thickness(5, 0, 5, 0); entreeCb.ItemsSource = GetItemsForComboBox(Menu.Entrees(), combo.Entree); entreeCb.HorizontalAlignment = HorizontalAlignment.Left; entreeCb.SetBinding(ComboBox.SelectedValueProperty, new Binding(combo.GetType().GetProperty("Entree").Name) { Source = combo, Mode = BindingMode.TwoWay }); MainPanel.Children.Add(entreeCb); setControls.Add(entreeCb); entreeCb.SelectedIndex = 0; Button customizeEntreeButton = new Button(); customizeEntreeButton.Content = "Customize Entree"; customizeEntreeButton.Click += CustomizeEntreeButtonClick; customizeEntreeButton.FontSize = 16; customizeEntreeButton.Margin = new Thickness(5, 0, 5, 0); customizeEntreeButton.HorizontalAlignment = HorizontalAlignment.Left; MainPanel.Children.Add(customizeEntreeButton); setControls.Add(customizeEntreeButton); //Side ComboBox sideCb = new ComboBox(); sideCb.FontSize = 16; sideCb.Margin = new Thickness(5, 0, 5, 0); sideCb.ItemsSource = GetItemsForComboBox(Menu.Sides(), combo.Side); sideCb.SelectedItem = combo.Side; sideCb.HorizontalAlignment = HorizontalAlignment.Left; sideCb.SetBinding(ComboBox.SelectedValueProperty, new Binding(combo.GetType().GetProperty("Side").Name) { Source = combo, Mode = BindingMode.TwoWay }); MainPanel.Children.Add(sideCb); setControls.Add(sideCb); sideCb.SelectedIndex = 0; Button customizeSideButton = new Button(); customizeSideButton.Content = "Customize Side"; customizeSideButton.Click += CustomizeSideButtonClick; customizeSideButton.FontSize = 16; customizeSideButton.Margin = new Thickness(5, 0, 5, 0); customizeSideButton.HorizontalAlignment = HorizontalAlignment.Left; MainPanel.Children.Add(customizeSideButton); setControls.Add(customizeSideButton); //Drink ComboBox drinkCb = new ComboBox(); drinkCb.FontSize = 16; drinkCb.Margin = new Thickness(5, 0, 5, 0); drinkCb.ItemsSource = GetItemsForComboBox(Menu.Drinks(), combo.Drink); drinkCb.HorizontalAlignment = HorizontalAlignment.Left; drinkCb.SetBinding(ComboBox.SelectedValueProperty, new Binding(combo.GetType().GetProperty("Drink").Name) { Source = combo, Mode = BindingMode.TwoWay }); MainPanel.Children.Add(drinkCb); setControls.Add(drinkCb); drinkCb.SelectedIndex = 0; Button customizeDrinkButton = new Button(); customizeDrinkButton.Content = "Customize Drink"; customizeDrinkButton.Click += CustomizeDrinkButtonClick; customizeDrinkButton.FontSize = 16; customizeDrinkButton.Margin = new Thickness(5, 0, 5, 0); customizeDrinkButton.HorizontalAlignment = HorizontalAlignment.Left; MainPanel.Children.Add(customizeDrinkButton); setControls.Add(customizeDrinkButton); }