private void addButtonsToForm()
        {
            List <MealCombination> mealCombos = CSVHandler.getMealCombinationsFromCSV(_mainMeal);

            grid.Children.Clear();
            int index = 0;

            foreach (MealCombination combo in mealCombos)
            {
                Button newBtn = new Button();
                grid.ColumnDefinitions.Add(new ColumnDefinition());
                newBtn.Content   = combo.secondMealName;
                newBtn.Name      = "secondMealButton";
                newBtn.Tag       = combo;
                newBtn.IsEnabled = !CSVHandler.isSecondMealDeactivated(combo.secondMealGUID);
                newBtn.Margin    = new Thickness(5, 0, 5, 0);
                newBtn.FontSize  = 18;
                newBtn.MinHeight = 200;
                newBtn.Click    += new RoutedEventHandler(secondMealButton_click);

                Grid.SetColumn(newBtn, index);
                index++;
                grid.Children.Add(newBtn);
            }
        }
Пример #2
0
 private void addMealCombinationsToDataGrid(MainMeal mainMeal)
 {
     mealCombos           = CSVHandler.getMealCombinationsFromCSV(mainMeal);
     dataGrid.ItemsSource = mealCombos;
 }