I tried really different ways to make my combobox working but I\'m still stuck :(
Here is a very simplified version of my app : (just edited, sorry for mistakes)
A couple things, first you are binding to Grade
and your property is called MyGrade
. Second you are instantiating different objects for grade in the Grades
list and using different objects to assign to each person, you want to use the same objects if you want them to map correctly, something like this:
Grades.Add(new Grade() { Name = "Grade 1", Prop = 1 });
Grades.Add(new Grade() { Name = "Grade 2", Prop = 2 });
People.Add(new Person() { Name = "guy 1", MyGrade = Grades[0] });
People.Add(new Person() { Name = "guy 2", MyGrade = Grades[0] });
People.Add(new Person() { Name = "guy 3", MyGrade = Grades[1] });
Lastly you might want to make the Grades collection an ObservableCollection
as well if you are going to bind it to the UI. Also it seems a bit odd that your RaisePropertyChanged
doesn't take in the name of the property.
There may be other mistakes as well but that is what jumped out to me right away.