I have MS SQL Server database with one table - Peoples. From these database generated Entity Framework Data model. In WPF application I have ListBox with ItemSource = DataModel.Entities.Peoples, and two buttons - add and remove People in database. Add button:
DataModel.Entities.AddPeople(new People("test"));
DataModel.Entities.SaveChanges();
And removing:
DataModel.Entities.Remove((People)listBox1.SelectedItem);
DataModel.Entities.SaveChanges();
When I click remove button - corresponding People row removing from databases and listBox1 refreshing. But when I click add button - People added in database (see in MS SQL Enterprise Manager), but listbox does not refreshing.
How to refresh listBox on adding? Guess I forgot to set any option in DataModel?