I am trying to make a program that has a data grid that shows on each row, List of Ingredients the pizza has, the pizza name, and the price of the pizza. I can get the data grid to show the name and price, but i am having trouble getting it to show the list of ingredients. The data grid's datasource is a binding list of a class called Pizza.
class Pizza
{
private List<Ingredients> ingredientList_;
private string pizzaName_;
private decimal retailPrice_;
public Pizza(List<Ingredients> ingredientList, string pizzaName, decimal retailPrice)
{
ingredientList_ = ingredientList;
pizzaName_ = pizzaName;
retailPrice_ = retailPrice;
}
It has the basic get and set properties. I also have an Ingredient class.
class Ingredients
{
private string name_;
private int servingSize_;
private int energyValue_;
private decimal purchasePrice_;
private bool isVegetarian_;
public Ingredients(string name, int servingSize, int energyValue, decimal purchasePrice, bool isVegetarian)
{
name_ = name;
servingSize_ = servingSize;
energyValue_ = energyValue;
purchasePrice_ = purchasePrice;
isVegetarian_ = isVegetarian;
}
Has the basic get and set properties.
In my form code, I have:
private BindingList<Pizza> pizzaList_;
pizzaList_ = new BindingList<Pizza>();
dataGridViewPizzaMenu.DataSource = pizzaList_;
Now my problem is that i am trying to use a combo box column to show the ingredients in a pizza when i click on it. But i can't seem to create a bound column for the Ingredients, only the pizza name and pizza price. Am i missing something or is what i am trying to do not possible?