I have the following scenario:
- User enters values in a form and submits
- The submit methods calls a service passing the form related object as a parameter
- The object is persisted in the db
- The object gets assigned a new ID and gets returned to the calling method
- The object is add to a collection in the submit method
I have an expander control that is bound to the collection using an item list and inside each list is a sub list.
What is the best practice for refreshing the view to show the updated object. What I was doing to refresh the collection was the following:
ObservableCollection<ProjectDto> projects = new ObservableCollection<ProjectDto>();
Projects.ForEach(projects.Add);
Projects.Clear();
projects.ForEach(Projects.Add);
This makes the expander collapse as I think it is being bound to a new collection.