|
Hello:
I've a question regarding best practices and data binding.
Let me quickly describe my two data structures. I have two Person and Country. The Person data structure contains a List<Country>, which indicates what countries the person has visited.
Now onto my UI.
Assume I have a List<Person>, which represents ALL people in a specific category. I bind the List<Person> to a ComboBox.
Now, I also have a separateList<Country>, which is a list of ALL countries in the world. Now, I'm binding this list to a DataGridView. In the DataGridView, I have two columns: one displaying the country's name and another that is a check box. Again, allcountries are displayed in the DataGridView. This DataGridView is just a selection that indicates WHAT COUNTRIES the person has visited.
Therefore, when the program is ran, initialization occurs: the combo box is populated with ALL users and the DataGridView is populated with ALL countries.When the user selects a person from the ComboBox, the countries the person has visited, which is stored in the Person's List<Country>should be checked. The user can uncheck and check countries; in the background, the Person data structure is adding or removing data objects of type Country from the Person's List<Country>.
What is the proper way to accomplish this scheme using DataGridView?
Thank you.
Trecius |