I am creating a WinForms application (for an instrumentation system) where the main form displays a list of equipment in a tableLayoutPanel wrapped in a groupBox. Each item has an associated label and comboBox. The application must populate the list of equipment at runtime, and then the user will select a value for each comboBox, which the application will fetch to run tests.
Here is a partial screenshot of what I'm describing:
I would like to make a class to hold the list of items, the possible options for the associated comboBox, and the user's selection and then data bind it such that changes to the class cause the correct controls to be created and populated. But I'm not sure if this is possible, and if it is, how I'd set up the binding sources?
Per this example, this is the class I think I should start with:
public class TestEquipment
{
public string Name { get; set; }
public List<string> Options { get; set; }
public string Selection { get; set; }
public TestEquipment(string name, string selection)
{
Name = name;
Selection = selection;
}
}